Commit 55396f534ed16f59b4d9663091ff40185d5f3302

Con Kolivas 2012-10-12T11:35:20

Fix 4 * 0 being 0 that would break dynamic intensity mode.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/driver-opencl.c b/driver-opencl.c
index 063c5c1..d558a82 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -1587,7 +1587,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work,
 			gpu_us = us_tdiff(&tv_gpuend, &gpu->tv_gpustart) / gpu->intervals;
 			/* Very rarely we may get an overflow so put an upper
 			 * limit on the detected time */
-			if (gpu_us > gpu->gpu_us_average * 4)
+			if (unlikely(gpu->gpu_us_average > 0 && gpu_us > gpu->gpu_us_average * 4))
 				gpu_us = gpu->gpu_us_average * 4;
 			gpu->gpu_us_average = (gpu->gpu_us_average + gpu_us * 0.63) / 1.63;