Core.len_hi: def of bend-collections-laws-crypto@1.0.0.0 Import: import bend-collections-laws-crypto@1.0.0.0/src/crypto/sha/core.bend as Core Lines 669-682 of bend-collections-laws-crypto@1.0.0.0/src/crypto/sha/core.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/sha/core.bend&start_line=669&end_line=682 import Base # Big-endian words of the 64-bit message bit length 8n, computed from n with # exactly the digit expressions bit_length produces, but without building and # matching an eight-element list. bit_length(n) is [o(d6), .., o(d0), low] # where d0 = n / 32, d(k+1) = dk / 256 and o(x) = x mod 256. def len_hi(+n: Nat) -> U32: +d0 = Nat.div(n, 32n) +d1 = Nat.div(d0, 256n) +d2 = Nat.div(d1, 256n) +d3 = Nat.div(d2, 256n) +d4 = Nat.div(d3, 256n) +d5 = Nat.div(d4, 256n) +d6 = Nat.div(d5, 256n) pack(U32.from_nat(Nat.mod(d6, 256n)), U32.from_nat(Nat.mod(d5, 256n)), U32.from_nat(Nat.mod(d4, 256n)), U32.from_nat(Nat.mod(d3, 256n))) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mod https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/sha/core.bend&name=pack