def pt_read
bendtorch@1.3.0.0 · main.bend:3449
import bendtorch@1.3.0.0/main.bend as Bendtorch
import Base
3449
3450
3451def pt_read(fuel: Nat, k: PK, +off: U32, rn: Array<F32> & F32) -> PTA:
3452 match fuel k rn:
3453 case 0n _ Tuple{xs, x}:
3454 PTA{PNew{False{}}, xs, off}
3455 case 1n+f KNew{} Tuple{xs, x}:
3456 PTA{PNew{U32.is_eq(ph_f2u(x), 1)}, xs, (off + 2 : U32)}
3457 case 1n++f KNode{} Tuple{xs, x}:
3458 pta_then(pt_read(f, pt_kind(ph_f2u(x)), (off + 1 : U32), Array.get(F32, xs, (off + 2 : U32))), ta => xs2 => +off2 => pta_node(ta, pt_next(off2, Array.get(F32, xs2, off2), kb => rb => pt_read(f, kb, off2, rb))))
3459 case 1n+f KLeaf{} Tuple{xs, x}:
3460 +n = ph_f2u(x)
3461 ptl_m(n, (off + 2 : U32), words_in(U32.to_nat(ph_hw(n)), 0, (off + 2 : U32), Array.get(F32, xs, (off + 2 : U32)), ph_words(U32.to_nat(n))))
3462 case 1n+f KLeafV{} Tuple{xs, x}:
3463 +n = ph_f2u(x)
3464 ptlv_m(n, (off + 2 : U32), words_in(U32.to_nat(ph_hw(n)), 0, (off + 2 : U32), Array.get(F32, xs, (off + 2 : U32)), ph_words(U32.to_nat(n))))