From a6ccc05e5fce1c7556e26f93def5dbe36b601cb3 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Mon, 20 Jan 2014 17:13:18 -0500 Subject: [PATCH] Replace multiply by 2 (i*2) with left shift. This should be slightly faster. Can't use OpenCL rotate becase of bit carry overs --- kernel/ckolivas.cl | 6 +++--- kernel/zuikkis.cl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/ckolivas.cl b/kernel/ckolivas.cl index b1e5dfac..6b264bc7 100644 --- a/kernel/ckolivas.cl +++ b/kernel/ckolivas.cl @@ -835,11 +835,11 @@ const uint4 midstate0, const uint4 midstate16, const uint target) { pad0 = tstate0; pad1 = tstate1; - X[i*2 ] = ostate0; - X[i*2+1] = ostate1; + X[i<<1 ] = ostate0; + X[(i<<1)+1] = ostate1; SHA256(&pad0,&pad1, data, (uint4)(i+1,K[84],0,0), (uint4)(0,0,0,0), (uint4)(0,0,0, K[87])); - SHA256(X+i*2,X+i*2+1, pad0, pad1, (uint4)(K[84], 0U, 0U, 0U), (uint4)(0U, 0U, 0U, K[88])); + SHA256(X+(i<<1),X+(i<<1)+1, pad0, pad1, (uint4)(K[84], 0U, 0U, 0U), (uint4)(0U, 0U, 0U, K[88])); } scrypt_core(X,padcache); SHA256(&tmp0,&tmp1, X[0], X[1], X[2], X[3]); diff --git a/kernel/zuikkis.cl b/kernel/zuikkis.cl index 99d23321..3b42574f 100644 --- a/kernel/zuikkis.cl +++ b/kernel/zuikkis.cl @@ -823,11 +823,11 @@ const uint4 midstate0, const uint4 midstate16, const uint target) { pad0 = tstate0; pad1 = tstate1; - X[i*2 ] = ostate0; - X[i*2+1] = ostate1; + X[i<<1 ] = ostate0; + X[(i<<1)+1] = ostate1; SHA256(&pad0,&pad1, data, (uint4)(i+1,K[84],0,0), (uint4)(0,0,0,0), (uint4)(0,0,0, K[87])); - SHA256(X+i*2,X+i*2+1, pad0, pad1, (uint4)(K[84], 0U, 0U, 0U), (uint4)(0U, 0U, 0U, K[88])); + SHA256(X+(i<<1),X+(i<<1)+1, pad0, pad1, (uint4)(K[84], 0U, 0U, 0U), (uint4)(0U, 0U, 0U, K[88])); } scrypt_core(X,padcache); SHA256(&tmp0,&tmp1, X[0], X[1], X[2], X[3]);