summaryrefslogtreecommitdiff
path: root/mpf/mul_2exp.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2000-06-05 20:30:17 +0200
committertege <tege@gmplib.org>2000-06-05 20:30:17 +0200
commit8eb7710c520f695e6b1e85bf60fca7bc8ac674f2 (patch)
treedaf08b11a419c7775f8faf64016717963099a61b /mpf/mul_2exp.c
parent7bb5bf89e67fe2d729d5ceb672cd46b7fe621795 (diff)
downloadgmp-8eb7710c520f695e6b1e85bf60fca7bc8ac674f2.tar.gz
* Correct criterion for whether to use mpn_lshift or mpn_rshift.
* MPN_COPY => MPN_COPY_INCR. * Coerce the two assignments to r->_mp_size.
Diffstat (limited to 'mpf/mul_2exp.c')
-rw-r--r--mpf/mul_2exp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/mpf/mul_2exp.c b/mpf/mul_2exp.c
index 0ed35a0b1..5c9be6ca0 100644
--- a/mpf/mul_2exp.c
+++ b/mpf/mul_2exp.c
@@ -60,14 +60,13 @@ mpf_mul_2exp (r, u, exp)
if (exp % BITS_PER_MP_LIMB == 0)
{
if (rp != up)
- MPN_COPY (rp, up, abs_usize);
- r->_mp_size = usize >= 0 ? abs_usize : -abs_usize;
+ MPN_COPY_INCR (rp, up, abs_usize);
r->_mp_exp = uexp + exp / BITS_PER_MP_LIMB;
}
else
{
mp_limb_t cy_limb;
- if (r != u)
+ if (rp >= up)
{
cy_limb = mpn_lshift (rp, up, abs_usize, exp % BITS_PER_MP_LIMB);
rp[abs_usize] = cy_limb;
@@ -83,7 +82,7 @@ mpf_mul_2exp (r, u, exp)
}
abs_usize += cy_limb;
- r->_mp_size = usize >= 0 ? abs_usize : -abs_usize;
r->_mp_exp = uexp + exp / BITS_PER_MP_LIMB + cy_limb;
}
+ r->_mp_size = usize >= 0 ? abs_usize : -abs_usize;
}