Browse Source

Ensure that we don't overflow due to 32 bit limitations.

ckolivas 14 years ago
parent
commit
e1dd27c5c2
2 changed files with 2 additions and 2 deletions
  1. 1 1
      cpu-miner.c
  2. 1 1
      findnonce.h

+ 1 - 1
cpu-miner.c

@@ -933,7 +933,7 @@ static void *gpuminer_thread(void *userdata)
 
 
 		/* This finish flushes the readbuffer set with CL_FALSE later */
 		/* This finish flushes the readbuffer set with CL_FALSE later */
 		clFinish(clState->commandQueue);
 		clFinish(clState->commandQueue);
-		if (diff.tv_sec > opt_scantime  || work->blk.nonce > MAXTHREADS - hashes || work_restart[thr_id].restart) {
+		if (diff.tv_sec > opt_scantime  || work->blk.nonce >= MAXTHREADS - hashes || work_restart[thr_id].restart) {
 			/* Ignore any reads since we're getting new work and queue a clean buffer */
 			/* Ignore any reads since we're getting new work and queue a clean buffer */
 			status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_FALSE, 0,
 			status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_FALSE, 0,
 					BUFFERSIZE, blank_res, 0, NULL, NULL);
 					BUFFERSIZE, blank_res, 0, NULL, NULL);

+ 1 - 1
findnonce.h

@@ -2,7 +2,7 @@
 #define __FINDNONCE_H__
 #define __FINDNONCE_H__
 #include "miner.h"
 #include "miner.h"
 
 
-#define MAXTHREADS (0xFFFFFFFF)
+#define MAXTHREADS (0xFFFFFFFEULL)
 #define BUFFERSIZE (sizeof(uint32_t) * 128)
 #define BUFFERSIZE (sizeof(uint32_t) * 128)
 
 
 extern void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data);
 extern void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data);