Browse Source

Merge branch 'master' into usb-dev

nfactor-troky
Con Kolivas 12 years ago
parent
commit
5c1f3b36d6
  1. 15
      cgminer.c

15
cgminer.c

@ -2187,8 +2187,12 @@ static bool solves_block(const struct work *work)
} }
memset(diffcmp, 0, 32); memset(diffcmp, 0, 32);
diffcmp[(diffbytes >> 2) + 1] = diffvalue >> (32 - diffshift); diffbytes >>= 2;
diffcmp[diffbytes >> 2] = diffvalue << diffshift; /* Sanity check looking for overflow */
if (unlikely(diffbytes > 6))
return false;
diffcmp[diffbytes + 1] = diffvalue >> (32 - diffshift);
diffcmp[diffbytes] = diffvalue << diffshift;
for (i = 7; i >= 0; i--) { for (i = 7; i >= 0; i--) {
if (hash32[i] > diffcmp[i]) if (hash32[i] > diffcmp[i])
@ -3485,8 +3489,11 @@ static void set_blockdiff(const struct work *work)
} }
memset(diffhash, 0, 32); memset(diffhash, 0, 32);
diffhash[(diffbytes >> 2) + 1] = diffvalue >> (32 - diffshift); diffbytes >>= 2;
diffhash[diffbytes >> 2] = diffvalue << diffshift; if (unlikely(diffbytes > 6))
return;
diffhash[diffbytes + 1] = diffvalue >> (32 - diffshift);
diffhash[diffbytes] = diffvalue << diffshift;
swab256(rhash, diffhash); swab256(rhash, diffhash);

Loading…
Cancel
Save