From 89b1f422fad8c50cd46b69748624d312922ef881 Mon Sep 17 00:00:00 2001 From: vlefevre Date: Wed, 22 Feb 2012 03:53:19 +0000 Subject: 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 --- src/print_raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/print_raw.c') diff --git a/src/print_raw.c b/src/print_raw.c index 4dbc4810c..71c0949ba 100644 --- a/src/print_raw.c +++ b/src/print_raw.c @@ -84,7 +84,7 @@ mpfr_print_mant_binary(const char *str, const mp_limb_t *p, mpfr_prec_t r) int i; mpfr_prec_t count = 0; char c; - mp_size_t n = (r - 1) / GMP_NUMB_BITS + 1; + mp_size_t n = MPFR_PREC2LIMBS (r); printf("%s ", str); for(n-- ; n>=0 ; n--) @@ -109,7 +109,7 @@ mpfr_dump_mant (const mp_limb_t *p, mpfr_prec_t r, mpfr_prec_t precx, int i; mpfr_prec_t count = 0; char c; - mp_size_t n = (r - 1) / GMP_NUMB_BITS + 1; + mp_size_t n = MPFR_PREC2LIMBS (r); for(n-- ; n>=0 ; n--) { -- cgit v1.2.1