def lemire

bend-collections-laws-crypto@1.0.0.0 · spec/math/random/rand.bend:59

import bend-collections-laws-crypto@1.0.0.0/spec/math/random/rand.bend as Rand
import Base

59# Lemire: the product x * n = hi * 2^w + lo
60def lemire(+w: Nat, +n: Nat, +hi: Nat, +lo: Nat) -> Maybe<&2, Nat>:
61  accept(hi, Bool.not(Bool.and(Nat.is_lt(lo, n), Nat.is_lt(lo, pow2mod(w, n)))))

Uses (7)

Used by (5)