summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-06-03 14:20:52 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-06-03 14:20:52 +0000
commit737c59ef6906e8eb2ce6b5dda90aa51e9cbab4ad (patch)
treedbe2b859faf28a9d0d2b0bdd0a2dcfc0cefb801c
parentd993492fda1077050b36937e9e2dd73172f38e62 (diff)
parenta21710f6c20e5b499b3d981efce8ca1941f2ca8f (diff)
downloadmpfr-737c59ef6906e8eb2ce6b5dda90aa51e9cbab4ad.tar.gz
Merged the latest change from the trunk (r10426 fix).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/ubf@10427 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/set_d.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/set_d.c b/src/set_d.c
index 417390106..f1123fa92 100644
--- a/src/set_d.c
+++ b/src/set_d.c
@@ -61,6 +61,7 @@ extract_double (mpfr_limb_ptr rp, double d)
((mp_limb_t) x.s.manh << (GMP_NUMB_BITS - 21)) |
((mp_limb_t) x.s.manl << (GMP_NUMB_BITS - 53)));
#else
+ MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 32);
manh = (MPFR_LIMB_ONE << 31) | (x.s.manh << 11) | (x.s.manl >> 21);
manl = x.s.manl << 11;
#endif
@@ -75,6 +76,7 @@ extract_double (mpfr_limb_ptr rp, double d)
((mp_limb_t) x.s.manl << (GMP_NUMB_BITS - 53)));
count_leading_zeros (cnt, manl);
#else
+ MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 32);
manh = (x.s.manh << 11) /* high 21 bits */
| (x.s.manl >> 21); /* middle 11 bits */
manl = x.s.manl << 11; /* low 21 bits */
@@ -85,7 +87,8 @@ extract_double (mpfr_limb_ptr rp, double d)
exp -= GMP_NUMB_BITS;
}
count_leading_zeros (cnt, manh);
- manh = (manh << cnt) | (manl >> (GMP_NUMB_BITS - cnt));
+ manh = (manh << cnt) |
+ (cnt != 0 ? manl >> (GMP_NUMB_BITS - cnt) : 0);
#endif
manl <<= cnt;
exp -= cnt;
@@ -129,6 +132,7 @@ extract_double (mpfr_limb_ptr rp, double d)
#if GMP_NUMB_BITS >= 64
manl = d;
#else
+ MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 32);
manh = (mp_limb_t) d;
manl = (mp_limb_t) ((d - manh) * MP_BASE_AS_DOUBLE);
#endif