code wiki / (root) / _nx_bits_clz64_speed_fast.nx

_nx_bits_clz64_speed_fast.nx source

↩ module page · 17 lines · 454 B

1// _nx_bits_clz64_speed_fast.nx -- 100M-iter loop calling FAST 2// nx_bits_clz64 (composed intrinsics; ~3 ops worst case). 3import "syscalls.nx" 4import "nx_bits.nx" 5 6func main() -> i64 { 7 let iters: i64 = 100000000 8 var acc: i64 = 0 9 var x: i64 = 0xCAFEBABE12345678 10 var i: i64 = 0 11 while i < iters { 12 acc = acc + nx_bits_clz64(x) 13 x = x * 6364136223846793005 + 1442695040888963407 14 i = i + 1 15 } 16 return acc & 0 17}