code wiki / (root) / _nx_bits_speed_soft.nx

_nx_bits_speed_soft.nx source

↩ module page · 18 lines · 528 B

1// _nx_bits_speed_soft.nx -- 10M-iter loop calling SOFT popcount only. 2// Same loop shape as _nx_bits_speed_fast.nx so wall-clock delta is 3// entirely the dispatch difference. 4import "syscalls.nx" 5import "nx_bits.nx" 6 7func main() -> i64 { 8 let iters: i64 = 100000000 // 100M 9 var acc: i64 = 0 10 var x: i64 = 0xCAFEBABE12345678 11 var i: i64 = 0 12 while i < iters { 13 acc = acc + nx_bits_popcount64_soft(x) 14 x = x * 6364136223846793005 + 1442695040888963407 15 i = i + 1 16 } 17 return acc & 0 18}