* Set nonce if it passes the threshold and no other thread has set it.
* Only high bits are needed for comparison since threshold low bits are zero.
*/
- if ((BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold) {
- let wasFound: u32 = atomicExchange(&work.found, 1u);
- work.nonce = select(work.nonce, m0, wasFound == 0u);
- }
+ work.nonce = select(work.nonce, m0, (BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold && atomicExchange(&work.found, 1u) == 0u);
return;
}