summaryrefslogtreecommitdiff
path: root/next.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-03-26 13:27:16 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-03-26 13:27:16 +0000
commit9f1f8d25b276fcfc67c6e231f9239b2e49646099 (patch)
tree743d3437a1426c0090f01ae1137e3261f42639a4 /next.c
parent59944129ef3733a50e0628588027047c03646d8f (diff)
downloadmpfr-9f1f8d25b276fcfc67c6e231f9239b2e49646099.tar.gz
Change from MP_LIMB_T_ONE to MPFR_LIMB_ONE and/or MPFR_LIMB_MASK.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2858 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'next.c')
-rw-r--r--next.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/next.c b/next.c
index ce230dafd..97a217c1c 100644
--- a/next.c
+++ b/next.c
@@ -43,11 +43,11 @@ mpfr_nexttozero (mpfr_ptr x)
int sh;
mp_limb_t *xp;
- xn = 1 + (MPFR_PREC(x) - 1) / BITS_PER_MP_LIMB;
- sh = (mp_prec_t) xn * BITS_PER_MP_LIMB - MPFR_PREC(x);
+ xn = MPFR_LIMB_SIZE (x);
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC(x));
xp = MPFR_MANT(x);
- mpn_sub_1 (xp, xp, xn, MP_LIMB_T_ONE << sh);
- if (xp[xn-1] >> (BITS_PER_MP_LIMB - 1) == 0)
+ mpn_sub_1 (xp, xp, xn, MPFR_LIMB_ONE << sh);
+ if (MPFR_UNLIKELY( MPFR_LIMB_MSB(xp[xn-1]) == 0) )
{ /* was an exact power of two: not normalized any more */
mp_exp_t exp = MPFR_EXP (x);
if (MPFR_UNLIKELY(exp == __gmpfr_emin))
@@ -77,10 +77,11 @@ mpfr_nexttoinf (mpfr_ptr x)
int sh;
mp_limb_t *xp;
- xn = 1 + (MPFR_PREC(x) - 1) / BITS_PER_MP_LIMB;
- sh = (mp_prec_t) xn * BITS_PER_MP_LIMB - MPFR_PREC(x);
+ xn = MPFR_LIMB_SIZE (x);
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC(x));
xp = MPFR_MANT(x);
- if (mpn_add_1 (xp, xp, xn, MP_LIMB_T_ONE << sh)) /* got 1.0000... */
+ if (MPFR_UNLIKELY( mpn_add_1 (xp, xp, xn, MPFR_LIMB_ONE << sh)) )
+ /* got 1.0000... */
{
mp_exp_t exp = MPFR_EXP (x);
if (MPFR_UNLIKELY(exp == __gmpfr_emax))