def keep
import bend-collections@1.0.0.0/src/crypto/blake/blake2s/blake2s.bend as Blake2simport Base
82# The final block keeps the bytes before the logical length and zeroes the rest.
83# keep(n, w) keeps the low n bytes of w.
84def keep(n: Nat, +w: U32) -> U32:
85 match n:
86 case 0n: 0
87 case 1n: U32.and(255,w)
88 case 2n: U32.and(65535,w)
89 case 3n: U32.and(16777215,w)
90 case 4n+p: w