def peek.got
import bend-kit-bits@0.1.0.1/bits.bend as Bitsimport Base
82# Bits past the end read as 0: the low avail bits stay LSB-first, the high ones MSB-first.
83def peek.got(+msb: Bool, +len: U32, +pos: U32, +n: U32, +avail: U32, r: Array<U32> & U32) -> Reader & U32:
84 (a, +w) = r
85 +v = field(msb, n, w)
86 (Reader{len, a, pos}, Bool.pick(U32, msb, (v .&. U32.shln(4294967295, U32.to_nat((n - avail : U32))) : U32), (v .&. mask(avail) : U32)))