def u32_to_nat_exact

mylsm-lsm-store@0.6.0.1 · src/Sstable.bend:123

import mylsm-lsm-store@0.6.0.1/src/Sstable.bend as Sstable
import Base

123# Encode or decode a 32-bit word for to nat exact for the SSTable indexes, filters, and lookup.
124def u32_to_nat_exact(+word: U32) -> Nat:
125  +b0 = u32_byte(word, 24n)
126  +b1 = u32_byte(word, 16n)
127  +b2 = u32_byte(word, 8n)
128  +b3 = u32_byte(word, 0n)
129  Nat.add(Nat.mul(b0, Nat.mul(Nat.mul(256n, 256n), 256n)), Nat.add(Nat.mul(b1, Nat.mul(256n, 256n)), Nat.add(Nat.mul(b2, 256n), b3)))

Uses (5)

Used by (0)

No other definition uses this definition.