-#if 0
-/// subMul - This function substracts x[len-1:0] * y from
-/// dest[offset+len-1:offset], and returns the most significant
-/// word of the product, minus the borrow-out from the subtraction.
-static uint32_t subMul(uint32_t dest[], uint32_t offset,
- uint32_t x[], uint32_t len, uint32_t y) {
- uint64_t yl = (uint64_t) y & 0xffffffffL;
- uint32_t carry = 0;
- uint32_t j = 0;
- do {
- uint64_t prod = ((uint64_t) x[j] & 0xffffffffUL) * yl;
- uint32_t prod_low = (uint32_t) prod;
- uint32_t prod_high = (uint32_t) (prod >> 32);
- prod_low += carry;
- carry = (prod_low < carry ? 1 : 0) + prod_high;
- uint32_t x_j = dest[offset+j];
- prod_low = x_j - prod_low;
- if (prod_low > x_j) ++carry;
- dest[offset+j] = prod_low;
- } while (++j < len);
- return carry;
-}
-
-/// unitDiv - This function divides N by D,
-/// and returns (remainder << 32) | quotient.
-/// Assumes (N >> 32) < D.
-static uint64_t unitDiv(uint64_t N, uint32_t D) {
- uint64_t q, r; // q: quotient, r: remainder.
- uint64_t a1 = N >> 32; // a1: high 32-bit part of N.
- uint64_t a0 = N & 0xffffffffL; // a0: low 32-bit part of N
- if (a1 < ((D - a1 - (a0 >> 31)) & 0xffffffffL)) {
- q = N / D;
- r = N % D;
- }
- else {
- // Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d
- uint64_t c = N - ((uint64_t) D << 31);
- // Divide (c1*2^32 + c0) by d
- q = c / D;
- r = c % D;
- // Add 2^31 to quotient
- q += 1 << 31;
- }
-
- return (r << 32) | (q & 0xFFFFFFFFl);
-}
-
-#endif
-
-/// div - This is basically Knuth's formulation of the classical algorithm.
-/// Correspondance with Knuth's notation:
-/// Knuth's u[0:m+n] == zds[nx:0].
-/// Knuth's v[1:n] == y[ny-1:0]
-/// Knuth's n == ny.
-/// Knuth's m == nx-ny.
-/// Our nx == Knuth's m+n.
-/// Could be re-implemented using gmp's mpn_divrem:
-/// zds[nx] = mpn_divrem (&zds[ny], 0, zds, nx, y, ny).
-