def len_lo

mylsm-lsm-store@0.6.0.1 · src/hub_sha/core.bend:803

import mylsm-lsm-store@0.6.0.1/src/hub_sha/core.bend as Core
import Base

803# Return the length of lo in the SHA-256 compression implementation.
804def len_lo(+byte_length: Nat) -> U32:
805  +d0 = Nat.div(byte_length, 32n)
806  +d1 = Nat.div(d0, 256n)
807  +d2 = Nat.div(d1, 256n)
808  pack(U32.from_nat(Nat.mod(d2, 256n)), U32.from_nat(Nat.mod(d1, 256n)),
809    U32.from_nat(Nat.mod(d0, 256n)), U32.shln(U32.from_nat(Nat.mod(byte_length, 32n)), 3n))

Uses (7)

Used by (64)