summaryrefslogtreecommitdiff
path: root/src/get_d.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2012-02-22 03:53:19 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2012-02-22 03:53:19 +0000
commit89b1f422fad8c50cd46b69748624d312922ef881 (patch)
treedad278625378912197929a89552863c7942f688b /src/get_d.c
parent6e9a7ddd09869245d0f46db6493370e0d9a98e54 (diff)
downloadmpfr-89b1f422fad8c50cd46b69748624d312922ef881.tar.gz
Avoid potential integer overflows and improve consistency. This should
fix bug #13918 "Segfault with precision = MPFR_PREC_MAX on 32-bit". Note: this problem appeared in MPFR 3.0.0 when the precision type (now mpfr_prec_t) was changed to a signed integer. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8025 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/get_d.c')
-rw-r--r--src/get_d.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/get_d.c b/src/get_d.c
index 49c8a4897..22386ecb8 100644
--- a/src/get_d.c
+++ b/src/get_d.c
@@ -100,7 +100,7 @@ mpfr_get_d (mpfr_srcptr src, mpfr_rnd_t rnd_mode)
nbits += (1021 + e);
MPFR_ASSERTD (nbits >= 1);
}
- np = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ np = MPFR_PREC2LIMBS (nbits);
MPFR_ASSERTD ( np <= MPFR_LIMBS_PER_DOUBLE );
carry = mpfr_round_raw_4 (tp, MPFR_MANT(src), MPFR_PREC(src), negative,
nbits, rnd_mode);