1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00

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

This commit is contained in:
ckolivas 2011-06-29 11:19:43 +10:00 committed by Con Kolivas
parent b38a02bd24
commit e1dd27c5c2
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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);