From 79e20147888328156f07667ed5430c218455adbb Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Wed, 5 Feb 2025 05:40:14 -0800 Subject: [PATCH] Replace another if statement with select. --- src/shaders/compute.wgsl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/shaders/compute.wgsl b/src/shaders/compute.wgsl index 9c5cf9c..0ea306e 100644 --- a/src/shaders/compute.wgsl +++ b/src/shaders/compute.wgsl @@ -1456,9 +1456,6 @@ 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. */ - 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; } -- 2.34.1