Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Fenwick / Binary Indexed Tree for prefix sums. The classic
`i & -i` low-bit trick needs negative-aware AND, but our `land`
evaluator (iter 127, bitwise via floor/mod arithmetic) only handles
non-negative operands. Workaround: a portable lowbit helper that
finds the largest power of 2 dividing i:
let lowbit i =
let r = ref 1 in
while !r * 2 <= i && i mod (!r * 2) = 0 do
r := !r * 2
done;
!r
After building from [1;3;5;7;9;11;13;15]:
total = prefix_sum 8 = 64
update 1 by +100
after = prefix_sum 8 = 164
total + after = 228
Tests recursive update / prefix_sum chains via helper-extracted
lowbit; documents a non-obvious limit of the bitwise-emulation
layer.
168 baseline programs total.