summaryrefslogtreecommitdiff
path: root/src/print_raw.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/print_raw.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/print_raw.c')
-rw-r--r--src/print_raw.c4
1 files changed, 2 insertions, 2 deletions
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--)
{