From: Chris Duncan Date: Wed, 5 Feb 2025 13:56:46 +0000 (-0800) Subject: Short-circuit 'and' does not appear to be working, at least within this select statement. X-Git-Tag: v3.0.0~25 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=620388d004c66a7e789ada76004d412266055e0b;p=nano-pow.git Short-circuit 'and' does not appear to be working, at least within this select statement. This reverts commit 79e20147888328156f07667ed5430c218455adbb. --- diff --git a/src/shaders/compute.wgsl b/src/shaders/compute.wgsl index 0ea306e..6f2a29a 100644 --- a/src/shaders/compute.wgsl +++ b/src/shaders/compute.wgsl @@ -1456,6 +1456,8 @@ fn main(id: vec3) { * 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. */ - work.nonce = select(work.nonce, m0, (BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold && atomicExchange(&work.found, 1u) == 0u); + if ((BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold && atomicExchange(&work.found, 1u) == 0u) { + work.nonce = m0; + } return; }