def bit_length

bend-collections@1.0.0.0 · src/crypto/sha512/core.bend:143

import bend-collections@1.0.0.0/src/crypto/sha512/core.bend as Core
import Base

143# 8n as sixteen big-endian octets: n div 32 in the top fifteen, 8 (n mod 32) last.
144def bit_length(+n: Nat) -> List<&2, U32>:
145  List.append(&2, U32, base256(15n, Nat.div(n, 32n)), [U32.shln(U32.from_nat(Nat.mod(n, 32n)), 3n)])

Uses (9)

Used by (1)