-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behaviour
We expect the trailing_zeros() function on u64 values to match the behavior of Rust's standard library implementation, returning the count of trailing zero bits.
For example:
0x0000000000000001_u64.trailing_zeros()should return 00x0000000100000000_u64.trailing_zeros()should return 320x8000000000000000_u64.trailing_zeros()should return 63
Example & Steps To Reproduce
0x0000000000000001Expected: 0, Result: 320x0000000100000000Expected: 32, Result: 00x8000000000000000Expected: 63, Result: 31
Run a shader that calculates trailing zeros on a u64. I am creating a pull request that contains test to validate the function and a fix for this issue.
#![no_std]
use spirv_std::spirv;
#[spirv(compute(threads(1)))]
pub fn main_cs(
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] output: &mut [u32],
) {
// Expected: 0, Actual: 32
output[0] = 0x0000000000000001_u64.trailing_zeros();
// Expected: 32, Actual: 0
output[1] = 0x0000000100000000_u64.trailing_zeros();
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working