From: Chris Duncan Date: Wed, 5 Feb 2025 13:38:28 +0000 (-0800) Subject: Use select instead of if statement. X-Git-Tag: v3.0.0~27 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=206d2fa18ef7b3206eb6ae27149c1e7ec28ef375;p=nano-pow.git Use select instead of if statement. --- diff --git a/src/shaders/compute.wgsl b/src/shaders/compute.wgsl index 4b14509..9c5cf9c 100644 --- a/src/shaders/compute.wgsl +++ b/src/shaders/compute.wgsl @@ -1458,9 +1458,7 @@ fn main(id: vec3) { */ if ((BLAKE2B_IV_0.y ^ v0.y ^ v8.y) >= ubo.threshold) { let wasFound: u32 = atomicExchange(&work.found, 1u); - if (wasFound == 0u) { - work.nonce = m0; - } + work.nonce = select(work.nonce, m0, wasFound == 0u); } return; }