def length_field

bend-collections@1.0.0.0 · spec/crypto/sha.bend:44

import bend-collections@1.0.0.0/spec/crypto/sha.bend as Sha
import Base

44# 8*n = 256*(n/32) + 8*(n mod 32); avoids overflowing runtime Nat.
45def length_field(+n: Nat) -> List<&2, U32>:
46  List.append(&2, U32, octets(7n, Nat.div(n, 32n)),
47    [U32.shln(U32.from_nat(Nat.mod(n, 32n)), 3n)])

Uses (9)

Used by (5)