]> zoso.dev Git - nano-pow.git/commitdiff
Short-circuit 'and' does not appear to be working, at least within this select statement.
authorChris Duncan <chris@zoso.dev>
Wed, 5 Feb 2025 13:56:46 +0000 (05:56 -0800)
committerChris Duncan <chris@zoso.dev>
Wed, 5 Feb 2025 13:56:46 +0000 (05:56 -0800)
This reverts commit 79e20147888328156f07667ed5430c218455adbb.

src/shaders/compute.wgsl

index 0ea306e1c3d55953774087d208018ad96016c77e..6f2a29a21e12693d1b58db24a74a78c3b0076d27 100644 (file)
@@ -1456,6 +1456,8 @@ fn main(id: vec3<u32>) {
        * 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;
 }