add method

void add(
  1. Element a,
  2. Element b
)

Add sets v = a + b, and returns v.

Implementation

void add(Element a, Element b) {
  l0 = a.l0 + b.l0;
  l1 = a.l1 + b.l1;
  l2 = a.l2 + b.l2;
  l3 = a.l3 + b.l3;
  l4 = a.l4 + b.l4;
  // Using the generic implementation here is actually faster than the
  // assembly. Probably because the body of this function is so simple that
  // the compiler can figure out better optimizations by inlining the carry
  // propagation.
  carryPropagateGeneric();
}