def mul_st

bend-collections-laws-crypto@1.0.0.0 · src/math/generic.bend:142

import bend-collections-laws-crypto@1.0.0.0/src/math/generic.bend as Generic
import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/num.bend as N

142# (value, still fits) after multiplying by x when bit is set
143def mul_st(~T: Data, ~op: N.Op<T> -> T, ~test: N.Test<T> -> Bool, bit: Bool, +x: T, +xok: Bool, st: T & Bool) -> T & Bool:
144  match bit st:
145    case False{} _:
146      st
147    case True{} Tuple{+a, +aok}:
148      (op(N.Mul{a, x}), Bool.and(Bool.and(aok, xok), Bool.not(test(N.MulOver{a, x}))))

Uses (7)

Used by (1)