_nx_bits_speed_fast.nx source
↩ module page · 18 lines · 566 B
1// _nx_bits_speed_fast.nx -- 10M-iter loop calling FAST popcount only.
2// Used by the speed bench harness which measures wall-clock via shell `time`.
3import "syscalls.nx"
4import "nx_bits.nx"
5
6func main() -> i64 {
7 let iters: i64 = 100000000 // 100M
8 var acc: i64 = 0
9 var x: i64 = 0xCAFEBABE12345678
10 var i: i64 = 0
11 while i < iters {
12 acc = acc + nx_bits_popcount64(x)
13 x = x * 6364136223846793005 + 1442695040888963407
14 i = i + 1
15 }
16 // Exit code must be 0 -- but encode acc's parity to defeat DCE.
17 return acc & 0
18}