def W64.mul_small

bendtorch-load@1.3.0.0 · main.bend:50

import bendtorch-load@1.3.0.0/main.bend as BendtorchLoad
import Base

50# a * k for k < 2^16 (enough for bytes a number and decimal digits), wrapping at 2^64: lo = l1 2^16 + l0, so
51# lo * k = (l1 k) 2^16 + l0 k, where both products fit a U32
52def W64.mul_small(a: W64, +k: U32) -> W64:
53  match a:
54    case W64{h, +l}: W64.mul_go(h, k, (U32.and(l, 65535) * k : U32), (U32.shrn(l, 16n) * k : U32))

Uses (6)

Used by (4)