Commit 2ed4072b5e02d06be905ee6588c02c51324d21ba

Con Kolivas 2012-07-13T19:18:11

Use cgminer specific output array entries in scrypt kernel.

diff --git a/scrypt120713.cl b/scrypt120713.cl
index 8826d0a..faedd34 100644
--- a/scrypt120713.cl
+++ b/scrypt120713.cl
@@ -685,12 +685,16 @@ void scrypt_core(uint4 X[8], __global uint4*restrict lookup)
 	unshittify(X);
 }
 
+#define FOUND (0x80)
+#define NFLAG (0x7F)
+
 __attribute__((reqd_work_group_size(WORKSIZE, 1, 1)))
 __kernel void search(__global uint4*restrict input, __global uint*restrict output, __global uint4*restrict padcache, uint4 pad0, uint4 pad1)
 {
+	uint gid = get_global_id(0);
 	uint4 X[8];
 	uint4 tstate0, tstate1, ostate0, ostate1, tmp0, tmp1;
-	uint4 data = (uint4)(input[4].x,input[4].y,input[4].z,get_global_id(0));
+	uint4 data = (uint4)(input[4].x,input[4].y,input[4].z,gid);
 
 	SHA256(&pad0,&pad1, data, (uint4)(0x80000000U,0,0,0), (uint4)(0,0,0,0), (uint4)(0,0,0,0x280));
 	SHA256_fresh(&ostate0,&ostate1, pad0^0x5C5C5C5CU, pad1^0x5C5C5C5CU, 0x5C5C5C5CU, 0x5C5C5C5CU);
@@ -718,7 +722,7 @@ __kernel void search(__global uint4*restrict input, __global uint*restrict outpu
 	SHA256(&ostate0,&ostate1, tmp0, tmp1, (uint4)(0x80000000U, 0U, 0U, 0U), (uint4)(0U, 0U, 0U, 0x300U));
 	
 	if ((ostate1.w&0xFFFF) == 0)
-		output[get_global_id(0)&255] = get_global_id(0);
+		output[FOUND] = output[NFLAG & gid] = gid;
 }
 
 /*-