def Table.get.go
bend-lint-api@0.2.0.0 · shared/tables.bend:12
import bend-lint-api@0.2.0.0/shared/tables.bend as Tables
import Base
12
13def Table.get.go(-A: Data, t: Table<A>, +i: U32, odd: Bool) -> Maybe<&2, A>:
14 match t odd:
15 case TLeaf{v} _:
16 Bool.pick(Maybe<&2, A>, U32.is_zero(i), v, None{})
17 case TNode{e, o} False{}:
18 Table.get.go(A, e, U32.shr(i), U32.is_eq(U32.and(U32.shr(i), 1), 1))
19 case TNode{e, o} True{}:
20 Table.get.go(A, o, U32.shr(i), U32.is_eq(U32.and(U32.shr(i), 1), 1))