8 #include <botan/divide.h>
9 #include <botan/internal/mp_core.h>
18 void sign_fixup(
const BigInt& x,
const BigInt& y, BigInt& q, BigInt&
r)
23 if(r.is_nonzero()) { --q; r = y.abs() -
r; }
63 const size_t n = r.
sig_words() - 1, t = y_words - 1;
71 while(r > y) { r -= y; ++q; }
73 sign_fixup(x, y_arg, q, r);
79 while(r >= temp) { r -= temp; ++q[n-t]; }
81 for(
size_t j = n; j != t; --j)
84 const word x_j1 = r.
word_at(j-1);
106 sign_fixup(x, y_arg, q, r);
word word_at(size_t n) const
void divide(const BigInt &x, const BigInt &y_arg, BigInt &q, BigInt &r)
s32bit cmp(const BigInt &n, bool check_signs=true) const
SecureVector< word > & get_reg()
word bigint_divop(word n1, word n0, word d)
size_t bigint_divcore(word q, word y2, word y1, word x3, word x2, word x1)
const word MP_WORD_TOP_BIT
const size_t MP_WORD_BITS