summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authortege <tege@gmplib.org>1998-05-05 01:35:30 +0200
committertege <tege@gmplib.org>1998-05-05 01:35:30 +0200
commit9f08792949575bf9c72f1f0f0b59e2f35e6708e8 (patch)
tree3aff41253c9267965ea5a811c0f375aee1fbdb7a /mpz
parenta9311d176c52d75ba7fc1d373533b579c0b83ffc (diff)
downloadgmp-9f08792949575bf9c72f1f0f0b59e2f35e6708e8.tar.gz
* Fix typo in test for whether to copy numerator to quotient and move that
statement to after handling quotient and denominator overlap. * Misc cleanups. * Change count argument of mpn_lshift/mpn_rshift calls to `unsigned int'.
Diffstat (limited to 'mpz')
-rw-r--r--mpz/divexact.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mpz/divexact.c b/mpz/divexact.c
index 25f81d9b1..2f726ffc0 100644
--- a/mpz/divexact.c
+++ b/mpz/divexact.c
@@ -86,10 +86,8 @@ mpz_divexact (quot, num, den)
while (dp[0] == 0)
np += 1, nsize -= 1, dp += 1, dsize -= 1;
tsize = MIN (qsize, dsize);
- if (dp[0] & 1)
+ if ((dp[0] & 1) != 0)
{
- if (qp != dp)
- MPN_COPY (qp, np, qsize);
if (qp == dp) /* QUOT and DEN overlap. */
{
tp = (mp_ptr) TMP_ALLOC (sizeof (mp_limb_t) * tsize);
@@ -97,18 +95,20 @@ mpz_divexact (quot, num, den)
}
else
tp = (mp_ptr) dp;
+ if (qp != np)
+ MPN_COPY (qp, np, qsize);
}
else
{
- unsigned long int r;
+ unsigned int r;
tp = (mp_ptr) TMP_ALLOC (sizeof (mp_limb_t) * tsize);
count_trailing_zeros (r, dp[0]);
mpn_rshift (tp, dp, tsize, r);
if (dsize > tsize)
- tp[tsize-1] |= dp[tsize] << (BITS_PER_MP_LIMB - r);
+ tp[tsize - 1] |= dp[tsize] << (BITS_PER_MP_LIMB - r);
mpn_rshift (qp, np, qsize, r);
if (nsize > qsize)
- qp[qsize-1] |= np[qsize] << (BITS_PER_MP_LIMB - r);
+ qp[qsize - 1] |= np[qsize] << (BITS_PER_MP_LIMB - r);
}
/* Now QUOT <-- QUOT/T. */