optimized nonce-check and output code for -v 2 and -v 4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
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;