summaryrefslogtreecommitdiff
path: root/urandomb.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-06-20 10:37:26 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-06-20 10:37:26 +0000
commit806f1ccb034f86156538488f6a4be140a851c982 (patch)
tree5d2c84cc5313052cd72990caa3fd992d8ebc4cff /urandomb.c
parentd03c269a1a918b390c891d52f40e738b4160a4ec (diff)
downloadmpfr-806f1ccb034f86156538488f6a4be140a851c982.tar.gz
Bug fix.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2351 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'urandomb.c')
-rw-r--r--urandomb.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/urandomb.c b/urandomb.c
index 2def51763..5d3754e01 100644
--- a/urandomb.c
+++ b/urandomb.c
@@ -53,7 +53,7 @@ mpfr_urandomb (mpfr_ptr rop, gmp_randstate_t rstate)
while (nlimbs != 0 && rp[nlimbs - 1] == 0)
{
nlimbs--;
- exp--;
+ exp -= BITS_PER_MP_LIMB;
}
if (nlimbs != 0) /* otherwise value is zero */
@@ -61,13 +61,12 @@ mpfr_urandomb (mpfr_ptr rop, gmp_randstate_t rstate)
count_leading_zeros (cnt, rp[nlimbs - 1]);
if (cnt != 0)
mpn_lshift (rp, rp, nlimbs, cnt);
- exp -= cnt;
+ MPFR_SET_EXP (rop, exp - cnt);
cnt = (mp_prec_t) nlimbs * BITS_PER_MP_LIMB - nbits;
/* cnt is the number of non significant bits in the low limb */
rp[0] &= ~((MP_LIMB_T_ONE << cnt) - 1);
}
- MPFR_SET_EXP (rop, exp);
MPFR_SET_POS (rop);
}