summaryrefslogtreecommitdiff
path: root/mpf/mul_2exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpf/mul_2exp.c')
-rw-r--r--mpf/mul_2exp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mpf/mul_2exp.c b/mpf/mul_2exp.c
index 16e2ee3f6..00f0e45e7 100644
--- a/mpf/mul_2exp.c
+++ b/mpf/mul_2exp.c
@@ -44,7 +44,7 @@ mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp)
abs_usize = ABS (usize);
up = u->_mp_d;
- if (exp % BITS_PER_MP_LIMB == 0)
+ if (exp % GMP_NUMB_BITS == 0)
{
prec++; /* retain more precision here as we don't need
to account for carry-out here */
@@ -55,7 +55,7 @@ mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp)
}
if (rp != up)
MPN_COPY_INCR (rp, up, abs_usize);
- r->_mp_exp = uexp + exp / BITS_PER_MP_LIMB;
+ r->_mp_exp = uexp + exp / GMP_NUMB_BITS;
}
else
{
@@ -68,19 +68,20 @@ mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp)
/* Use mpn_rshift since mpn_lshift operates downwards, and we
therefore would clobber part of U before using that part, in case
R is the same variable as U. */
- cy_limb = mpn_rshift (rp + 1, up, abs_usize, (-exp) % BITS_PER_MP_LIMB);
+ cy_limb = mpn_rshift (rp + 1, up, abs_usize,
+ GMP_NUMB_BITS - exp % GMP_NUMB_BITS);
rp[0] = cy_limb;
adj = rp[abs_usize] != 0;
}
else
{
- cy_limb = mpn_lshift (rp, up, abs_usize, exp % BITS_PER_MP_LIMB);
+ cy_limb = mpn_lshift (rp, up, abs_usize, exp % GMP_NUMB_BITS);
rp[abs_usize] = cy_limb;
adj = cy_limb != 0;
}
abs_usize += adj;
- r->_mp_exp = uexp + exp / BITS_PER_MP_LIMB + adj;
+ r->_mp_exp = uexp + exp / GMP_NUMB_BITS + adj;
}
r->_mp_size = usize >= 0 ? abs_usize : -abs_usize;
}