summaryrefslogtreecommitdiff
path: root/set_ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'set_ui.c')
-rw-r--r--set_ui.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/set_ui.c b/set_ui.c
index 49188522d..63c48833d 100644
--- a/set_ui.c
+++ b/set_ui.c
@@ -1,6 +1,6 @@
/* mpfr_set_ui -- set a MPFR number from a machine unsigned integer
-Copyright 1999, 2000, 2001, 2002 Free Software Foundation.
+Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation.
This file is part of the MPFR Library.
@@ -48,7 +48,8 @@ mpfr_set_ui (mpfr_ptr x, unsigned long i, mp_rnd_t rnd_mode)
/* don't forget to put zero in lower limbs */
MPN_ZERO(xp, xn);
- MPFR_EXP(x) = nbits = BITS_PER_MP_LIMB - cnt;
+ nbits = BITS_PER_MP_LIMB - cnt;
+ MPFR_SET_EXP (x, nbits);
inex = mpfr_check_range(x, 0, rnd_mode);
if (inex)
return inex; /* underflow or overflow */
@@ -61,12 +62,12 @@ mpfr_set_ui (mpfr_ptr x, unsigned long i, mp_rnd_t rnd_mode)
rnd_mode, &inex);
if (carry)
{
- mp_exp_t exp = MPFR_EXP(x);
+ mp_exp_t exp = MPFR_GET_EXP (x);
if (exp == __gmpfr_emax)
return mpfr_set_overflow(x, rnd_mode, 1);
- MPFR_EXP(x)++;
+ MPFR_SET_EXP (x, exp + 1);
xp[xn] = MPFR_LIMB_HIGHBIT;
}
}