Commit aa52e7dfd7d08b4a29d728cf79707f27b027cbd6

Philip Kaufmann 2012-03-01T17:24:38

optimized nonce-check and output code for -v 2 and -v 4

diff --git a/diakgcn120223.cl b/diakgcn120223.cl
index de9ce58..ada1937 100644
--- a/diakgcn120223.cl
+++ b/diakgcn120223.cl
@@ -1,4 +1,4 @@
-// DiaKGCN 24-02-2012 - OpenCL kernel by Diapolo
+// DiaKGCN 01-03-2012 - OpenCL kernel by Diapolo
 //
 // Parts and / or ideas for this kernel are based upon the public-domain poclbm project, the phatk kernel by Phateus and the DiabloMiner kernel by DiabloD3.
 // The kernel was rewritten by me (Diapolo) and is still public-domain!
@@ -571,7 +571,6 @@ __kernel
 
 	V[7] += V[3] + W[12] + ch(V[0], V[1], V[2]) + rotr26(V[0]);
 
-
 #define FOUND (0x80)
 #define NFLAG (0x7F)
 
@@ -599,31 +598,11 @@ __kernel
 			output[FOUND] = output[NFLAG & nonce.s7] = nonce.s7;
 	}
 #elif defined VECTORS4
-	V[7] ^= 0x136032edU;
-
-	bool result = V[7].x & V[7].y & V[7].z & V[7].w;
-
-	if (!result) {
-		if (!V[7].x)
-			output[FOUND] = output[NFLAG & nonce.x] = nonce.x;
-		if (!V[7].y)
-			output[FOUND] = output[NFLAG & nonce.y] = nonce.y;
-		if (!V[7].z)
-			output[FOUND] = output[NFLAG & nonce.z] = nonce.z;
-		if (!V[7].w)
-			output[FOUND] = output[NFLAG & nonce.w] = nonce.w;
-	}
+	if ((V[7].x == 0x136032edU) ^ (V[7].y == 0x136032edU) ^ (V[7].z == 0x136032edU) ^ (V[7].w == 0x136032edU))
+		output[FOUND] = output[NFLAG & nonce.x] = (V[7].x == 0x136032edU) ? nonce.x : ((V[7].y == 0x136032edU) ? nonce.y : ((V[7].z == 0x136032edU) ? nonce.z : nonce.w));
 #elif defined VECTORS2
-	V[7] ^= 0x136032edU;
-
-	bool result = V[7].x & V[7].y;
-
-	if (!result) {
-		if (!V[7].x)
-			output[FOUND] = output[NFLAG & nonce.x] = nonce.x;
-		if (!V[7].y)
-			output[FOUND] = output[NFLAG & nonce.y] = nonce.y;
-	}
+	if ((V[7].x == 0x136032edU) + (V[7].y == 0x136032edU))
+		output[FOUND] = output[NFLAG & nonce.x] = (V[7].x == 0x136032edU) ? nonce.x : nonce.y;
 #else
 	if (V[7] == 0x136032edU)
 		output[FOUND] = output[NFLAG & nonce] = nonce;