return carry != 0;
}
+bool bigadd(unsigned result[], unsigned vn[], unsigned un[],
+ int m, int n, bool ca)
+{
+ // VL = n + 1
+ // sv.subfe un_j.v, product.v, un_j.v
+ for (int i = 0; i <= n; i++)
+ {
+ uint64_t value = (uint64_t)vn[i] + (uint64_t)un[i] + ca;
+ ca = value >> 32 != 0;
+ result[i] = value;
+ }
+ return ca;
+}
+
bool bigsub(unsigned result[], unsigned vn[], unsigned un[],
int m, int n, bool ca)
{
if (need_fixup)
{ // If we subtracted too
q[j] = q[j] - 1; // much, add back.
- k = 0;
- for (i = 0; i < n; i++)
- {
- t = (unsigned long long)un[i + j] + vn[i] + k;
- un[i + j] = t;
- k = t >> 32;
- }
- un[j + n] = un[j + n] + k;
+ bigadd(un_j, vn, un_j, m, n, 0);
}
} // End j.
// If the caller wants the remainder, unnormalize