def AP.get_v

bend-osdev-array@0.1.0.1 · PROOF.bend:569

import bend-osdev-array@0.1.0.1/PROOF.bend as PROOF
import Base

569def AP.get_v(-T: Data, t: AP.Tree<T>, n: U32, +i: U32, z: Bool) -> T:
570  match t z:
571    case APLeaf{x} _:
572      x
573    case APNode{xs, ys} True{}:
574      +h = U32.shr(n)
575      AP.get_v(T, xs, h, i, U32.is_lt(i, U32.shr(h)))
576    case APNode{xs, ys} False{}:
577      +h = U32.shr(n)
578      +j = U32.sub(i, h)
579      AP.get_v(T, ys, h, j, U32.is_lt(j, U32.shr(h)))

Uses (6)

Used by (8)