]> zoso.dev Git - nano-pow.git/commitdiff
Use select instead of if statement.
authorChris Duncan <chris@zoso.dev>
Wed, 5 Feb 2025 13:38:28 +0000 (05:38 -0800)
committerChris Duncan <chris@zoso.dev>
Wed, 5 Feb 2025 13:38:28 +0000 (05:38 -0800)
src/shaders/compute.wgsl

index 4b145096375eb38edf905088bf89816bd2519c32..9c5cf9ca89a0ac384d4e658bf61fe921001cc32f 100644 (file)
@@ -1458,9 +1458,7 @@ fn main(id: vec3<u32>) {
        */
        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;
 }