code wiki / (root) / _clz_test.nx

_clz_test.nx source

↩ module page · 13 lines · 372 B

1import "syscalls.nx" 2 3func main() -> i64 { 4 let a: i64 = __clz32(1) // expect 31 5 let b: i64 = __clz32(0) // expect 32 6 let c: i64 = __clz32(0x80000000) // expect 0 7 let d: i64 = __clz32(0x12345678) // expect 3 8 if a != 31 { return 11 } 9 if b != 32 { return 12 } 10 if c != 0 { return 13 } 11 if d != 3 { return 14 } 12 return 0 13}