def keep

bend-collections-laws-crypto@1.0.0.0 · spec/crypto/blake/blake2b.bend:207

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

207# The low n bytes of a little-endian word (all four when n >= 4).
208def keep(w: U32, n: Nat) -> U32:
209  match n:
210    case 0n: 0
211    case 1n: U32.and(w,255)
212    case 2n: U32.and(w,65535)
213    case 3n: U32.and(w,16777215)
214    case _: w

Uses (3)

Used by (2)