mult32 method

void mult32(
  1. Element x,
  2. int y
)

Mult32 sets v = x * y, and returns v.

Implementation

void mult32(Element x, int y) {
  final (x0lo, x0hi) = mul51(x.l0, y);
  final (x1lo, x1hi) = mul51(x.l1, y);
  final (x2lo, x2hi) = mul51(x.l2, y);
  final (x3lo, x3hi) = mul51(x.l3, y);
  final (x4lo, x4hi) = mul51(x.l4, y);
  l0 = x0lo + bigInt19 * x4hi; // carried over per the reduction identity
  l1 = x1lo + x0hi;
  l2 = x2lo + x1hi;
  l3 = x3lo + x2hi;
  l4 = x4lo + x3hi;
  // The hi portions are going to be only 32 bits, plus any previous excess,
  // so we can skip the carry propagation.
}