def Arrays.index
import bend-osdev-array@0.1.0.1/array.bend as Arrayimport 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)))