Browse Source

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

nfactor-troky
ckolivas 14 years ago committed by Con Kolivas
parent
commit
e1dd27c5c2
  1. 2
      cpu-miner.c
  2. 2
      findnonce.h

2
cpu-miner.c

@ -933,7 +933,7 @@ static void *gpuminer_thread(void *userdata) @@ -933,7 +933,7 @@ static void *gpuminer_thread(void *userdata)
/* This finish flushes the readbuffer set with CL_FALSE later */
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 */
status = clEnqueueWriteBuffer(clState->commandQueue, clState->outputBuffer, CL_FALSE, 0,
BUFFERSIZE, blank_res, 0, NULL, NULL);

2
findnonce.h

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

Loading…
Cancel
Save