def tnode
bendtorch-gpu@1.3.0.0 · main.bend:1371
import bendtorch-gpu@1.3.0.0/main.bend as BendtorchGpu
import Base
1371
1372
1373
1374def tnode(l: Nat, big: Bool, +lo: U32, +len: U32, +h: U32, a: Array<F32>) -> TS:
1375 match l big:
1376 case 0n _: ts_leaf(Array.get(F32, a, lo))
1377 case 1n++q True{}: ts_then(tnode(q, U32.is_lt(U32.shr(h), h), lo, h, U32.shr(h), a), +s => a2 => ts_plus(s, tnode(q, U32.is_lt(U32.shr(h), (len - h : U32)), (lo + h : U32), (len - h : U32), U32.shr(h), a2)))
1378 case 1n+q False{}: tnode(q, U32.is_lt(U32.shr(h), len), lo, len, U32.shr(h), a)