def ts_lv
import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpuimport Base
1380# the passes tree_sum makes over m cells: the smallest l with 2^l >= m (f is fuel)
1381def ts_lv(f: Nat, +m: U32, +p: U32) -> Nat:
1382 match f:
1383 case 0n: 0n
1384 # bend-lint: disable-next bend-lint-rules/performance/eager_branch -- a loop of at most 32 U32 steps on the host, once per bang launch not-expected-because: a launch costs about 1 ms, the whole walk well under a microsecond
1385 case 1n+q: Bool.pick(Nat, U32.is_lt(p, m), 1n+ts_lv(q, m, (p * 2 : U32)), 0n)