def Arrays.index

bend-osdev-array@0.1.0.1 · array.bend:44

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

44# the slot that Array.get and Array.set use for index i on an array of depth
45# d: i masked to its low d bits, as Base computes it
46def Arrays.index(d: Nat, i: U32) -> Nat:
47  U32.to_nat(U32.and(i, U32.sub(U32.shln(1, d), 1)))

Uses (6)

Used by (55)