printf("\n");
}
-bool bigmul(unsigned long long qhat, unsigned product[], unsigned vn[],
- int m, int n)
+bool bigmul(unsigned long long qhat, unsigned product[], unsigned vn[], int m,
+ int n)
{
long long t, k;
int s, i;
return carry != 0;
}
-bool bigadd(unsigned result[], unsigned vn[], unsigned un[],
- int m, int n, bool ca)
+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
return ca;
}
-bool bigsub(unsigned result[], unsigned vn[], unsigned un[],
- int m, int n, bool ca)
+bool bigsub(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
return ca;
}
-bool bigmulsub(unsigned long long qhat, unsigned vn[], unsigned un[],
- int j, int m, int n)
+bool bigmulsub(unsigned long long qhat, unsigned vn[], unsigned un[], int j,
+ int m, int n)
{
// Multiply and subtract.
uint32_t product[n + 1];
int m, int n)
{
- const unsigned long long b = 1LL<<32; // Number base (2**32).
- unsigned *un, *vn; // Normalized form of u, v.
- unsigned long long qhat; // Estimated quotient digit.
- unsigned long long rhat; // A remainder.
- unsigned long long p; // Product of two digits.
+ const unsigned long long b = 1LL << 32; // Number base (2**32).
+ unsigned *un, *vn; // Normalized form of u, v.
+ unsigned long long qhat; // Estimated quotient digit.
+ unsigned long long rhat; // A remainder.
+ unsigned long long p; // Product of two digits.
long long t, k;
int s, i, j;
{ // Take care of
k = 0; // the case of a
for (j = m - 1; j >= 0; j--)
- { // single-digit
- uint64_t dig2 = (k << 32 ) | u[j];
+ { // single-digit
+ uint64_t dig2 = (k << 32) | u[j];
q[j] = dig2 / v[0]; // divisor here.
- k = dig2 % v[0]; // modulo back into next loop
+ k = dig2 % v[0]; // modulo back into next loop
}
if (r != NULL)
r[0] = k;
qhat = dig1 / vn[n - 1];
rhat = dig1 % vn[n - 1];
uint64_t dig2 = ((uint64_t)rhat << 32) | un[j + n - 1];
- qhat = dig2 / vn[n - 1] | (qhat<<32);
- rhat = dig2 % vn[n - 1] | (rhat<<32);
+ qhat = dig2 / vn[n - 1] | (qhat << 32);
+ rhat = dig2 % vn[n - 1] | (rhat << 32);
again:
// use 3rd-from-top digit to obtain better accuracy
if (qhat >= b || qhat * vn[n - 2] > b * rhat + un[j + n - 2])