From 7c01f1659362048caa5adf73edb96300718a2dd6 Mon Sep 17 00:00:00 2001 From: Denis Ahrens Date: Tue, 11 Dec 2012 23:47:26 +0100 Subject: [PATCH 1/2] driver-ztex: search the complete noncerange based on the actual speed search the complete noncerange until the range to the end is more work than at the last round. doing one more round would mean we would have a overrun, which is a waste. with actual ztex boards this means that a new getwork is needed every 19 seconds in general and not every 10 seconds (without rollntime). --- driver-ztex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver-ztex.c b/driver-ztex.c index d126580a..2b8d82e8 100644 --- a/driver-ztex.c +++ b/driver-ztex.c @@ -282,7 +282,7 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work, #endif if (nonce > noncecnt) noncecnt = nonce; - if (((nonce & 0x7fffffff) >> 4) < ((lastnonce[i] & 0x7fffffff) >> 4)) { + if (((0xffffffff - nonce) < (nonce - lastnonce[i])) || nonce < lastnonce[i]) { applog(LOG_DEBUG, "%s: overflow nonce=%0.8x lastnonce=%0.8x", ztex->repr, nonce, lastnonce[i]); overflow = true; } else From abae6b983a7ccf7d37aeab9272b4cb8cea7a113a Mon Sep 17 00:00:00 2001 From: Denis Ahrens Date: Thu, 13 Dec 2012 00:21:21 +0100 Subject: [PATCH 2/2] driver-ztex: use the correct size for the swap array --- driver-ztex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver-ztex.c b/driver-ztex.c index 2b8d82e8..ba3e7bbc 100644 --- a/driver-ztex.c +++ b/driver-ztex.c @@ -151,7 +151,7 @@ static bool ztex_checkNonce(struct libztex_device *ztex, struct libztex_hash_data *hdata) { uint32_t *data32 = (uint32_t *)(work->data); - unsigned char swap[128]; + unsigned char swap[80]; uint32_t *swap32 = (uint32_t *)swap; unsigned char hash1[32]; unsigned char hash2[32];