From 6970714ae1d938d39cb67073bc435fb1a42dd7ac Mon Sep 17 00:00:00 2001 From: nelisky Date: Wed, 18 Apr 2012 01:59:48 -0700 Subject: [PATCH] Use detected endianness for ztex overflow detection and hash rate reporting --- ztex.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ztex.c b/ztex.c index aed46609..e5ada7be 100644 --- a/ztex.c +++ b/ztex.c @@ -209,14 +209,21 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work, ztex->errorWeight[ztex->freqM] = ztex->errorWeight[ztex->freqM] * 0.995 + 1.0; for (i=0; inumNonces; i++) { - nonce = swab32(hdata[i].nonce); + nonce = hdata[i].nonce; +#if defined(__BIGENDIAN__) || defined(MIPSEB) + nonce = swab32(nonce); +#endif if (nonce > noncecnt) noncecnt = nonce; - if ((nonce >> 4) < (lastnonce[i] >> 4)) { + if (((nonce & 0x7fffffff) >> 4) < ((lastnonce[i] & 0x7fffffff) >> 4)) { + applog(LOG_DEBUG, "%s: overflow nonce=%0.8x lastnonce=%0.8x", ztex->repr, nonce, lastnonce[i]); overflow = true; } else { lastnonce[i] = nonce; } +#if !(defined(__BIGENDIAN__) || defined(MIPSEB)) + nonce = swab32(nonce); +#endif if (!ztex_checkNonce(ztex, work, &hdata[i])) { thr->cgpu->hw_errors++; continue;