Skip to content

Commit 7a323b0

Browse files
committed
Simplify bit-shifting
1 parent 10babfd commit 7a323b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml/src/ggml-webgpu/wgsl-shaders/memset.wgsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
3232
let bit_offset = (idx & 3) * 8u;
3333
let mask = ~(0xffu << bit_offset);
3434
let existing = output_buffer[word_idx];
35-
output_buffer[word_idx] = (existing & mask) | (((params.value >> bit_offset) & 0xff) << bit_offset);
35+
output_buffer[word_idx] = (existing & mask) | (params.value & (0xffu << bit_offset));
3636
}
3737
}
3838
}

0 commit comments

Comments
 (0)