Browse Source

Merge commit '9896585' into bfgminer-3.10.x

Luke Dashjr 11 years ago
parent
commit
ab303f84aa
1 changed files with 4 additions and 4 deletions
  1. 4 4
      deviceapi.c

+ 4 - 4
deviceapi.c

@@ -123,14 +123,14 @@ bool hashes_done(struct thr_info *thr, int64_t hashes, struct timeval *tvp_hashe
 		
 		
 		mult = 1000000 / ((thr->tv_hashes_done.tv_usec + 0x400) / 0x400) + 0x10;
 		mult = 1000000 / ((thr->tv_hashes_done.tv_usec + 0x400) / 0x400) + 0x10;
 		mult *= cycle;
 		mult *= cycle;
-		if (*max_nonce > (0xffffffff * 0x400) / mult)
+		if (*max_nonce > ((uint64_t)0xffffffff * 0x400) / mult)
 			*max_nonce = 0xffffffff;
 			*max_nonce = 0xffffffff;
 		else
 		else
-			*max_nonce = (*max_nonce * mult) / 0x400;
+			*max_nonce = ((uint64_t)*max_nonce * mult) / 0x400;
 	} else if (unlikely(thr->tv_hashes_done.tv_sec > cycle) && max_nonce)
 	} else if (unlikely(thr->tv_hashes_done.tv_sec > cycle) && max_nonce)
-		*max_nonce = *max_nonce * cycle / thr->tv_hashes_done.tv_sec;
+		*max_nonce = (uint64_t)*max_nonce * cycle / thr->tv_hashes_done.tv_sec;
 	else if (unlikely(thr->tv_hashes_done.tv_usec > 100000) && max_nonce)
 	else if (unlikely(thr->tv_hashes_done.tv_usec > 100000) && max_nonce)
-		*max_nonce = *max_nonce * 0x400 / (((cycle * 1000000) + thr->tv_hashes_done.tv_usec) / (cycle * 1000000 / 0x400));
+		*max_nonce = (uint64_t)*max_nonce * 0x400 / ((((uint64_t)cycle * 1000000) + thr->tv_hashes_done.tv_usec) / ((uint64_t)cycle * 1000000 / 0x400));
 	
 	
 	hashmeter2(thr);
 	hashmeter2(thr);