def keep

bend-collections-laws-crypto@1.0.0.0 · src/crypto/blake/blake2b/blake2b.bend:137

import bend-collections-laws-crypto@1.0.0.0/src/crypto/blake/blake2b/blake2b.bend as Blake2b
import Base

137# Only the first n bytes of the word are message bytes; the rest are zero.
138def keep(w: U32, n: Nat) -> U32:
139  match n:
140    case 0n: 0
141    case 1n: U32.and(w,255)
142    case 2n: U32.and(w,65535)
143    case 3n: U32.and(w,16777215)
144    case _: w

Uses (3)

Used by (2)