def mpow_go
bend-collections-laws-crypto@1.0.0.0 · src/math/w64.bend:618
import bend-collections-laws-crypto@1.0.0.0/src/math/w64.bend as W64
import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend as W
618
619def mpow_go(fuel: Nat, +m: W.U64, +mp: W.U64, +b: W.U64, +acc: W.U64, st: W.U64 & Bool) -> W.U64:
620 match fuel st:
621 case 0n _:
622 acc
623 case 1n+f Tuple{e, True{}}:
624 acc
625 case 1n+f Tuple{+e, False{}}:
626 mpow_go(f, m, mp, mont(m, mp, b, b), mbit(odd(e), m, mp, b, acc), (half(e), is_zero(half(e))))