File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -180,22 +180,28 @@ fn hash_compute(
180180 let mut w2pow = 1u64 ;
181181
182182 for _ in 0 ..nonce % POW_WARP_SIZE {
183- for _ in 0 ..POW_DATA_PER_THREAD {
184- wpow = wpow * ( w as u64 ) % POW_MOD64 ;
185- w2pow = w2pow * w2 % POW_MOD64 ;
186- }
183+ wpow = wpow * ( w as u64 ) % POW_MOD64 ;
184+ w2pow = w2pow * w2 % POW_MOD64 ;
185+ }
186+ let mut full_wpow = wpow;
187+ let mut full_w2pow = w2pow;
188+ for _ in nonce % POW_WARP_SIZE ..POW_WARP_SIZE {
189+ full_wpow = full_wpow * ( w as u64 ) % POW_MOD64 ;
190+ full_w2pow = full_w2pow * w2 % POW_MOD64 ;
187191 }
188192
189193 let mut result = 0u64 ;
190- for _ in 0 ..POW_DATA_PER_THREAD {
194+ for i in 0 ..POW_DATA_PER_THREAD {
191195 let x = ( a * w2pow + b * wpow + c) % POW_MOD64 ;
192196 let mut pv = 0 ;
193197 for j in 0 ..POW_N {
194198 pv = ( pv * x + d[ ( POW_N - j - 1 ) as usize ] as u64 ) % POW_MOD64 ;
195199 }
196200 result = fnv_hash64 ( result, pv) ;
197- wpow = wpow * ( w as u64 ) % POW_MOD64 ;
198- w2pow = w2pow * w2 % POW_MOD64 ;
201+ if i + 1 < POW_DATA_PER_THREAD {
202+ wpow = wpow * full_wpow % POW_MOD64 ;
203+ w2pow = w2pow * full_w2pow % POW_MOD64 ;
204+ }
199205 }
200206
201207 macro_rules! make_const_array {
You can’t perform that action at this time.
0 commit comments