summaryrefslogtreecommitdiff
path: root/src/set_prec.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-09-27 15:10:30 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-09-27 15:10:30 +0000
commit4292560697b56ebc25df3e1669bd345ffc4f7484 (patch)
tree83f90a73e964e8d66a6195fded0481dc752a0db0 /src/set_prec.c
parentdbad66e5f328924afc32904740aac1351db1ae06 (diff)
downloadmpfr-4292560697b56ebc25df3e1669bd345ffc4f7484.tar.gz
[src]
* mpfr-impl.h: document the memory allocated for a significand; added a cast to avoid a direct conversion from mp_limb_t * to mp_size_t *. * init2.c, round_prec.c, set_prec.c: code clean-up by correcting the type expected for the second argument of MPFR_SET_MANT_PTR (this macro has a cast, so that this should not change anything, but the old type mpfr_limb_ptr was meaningless and confusing). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10902 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/set_prec.c')
-rw-r--r--src/set_prec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/set_prec.c b/src/set_prec.c
index bd2864dd9..eb2a721c7 100644
--- a/src/set_prec.c
+++ b/src/set_prec.c
@@ -26,7 +26,6 @@ MPFR_HOT_FUNCTION_ATTR void
mpfr_set_prec (mpfr_ptr x, mpfr_prec_t p)
{
mp_size_t xsize, xoldsize;
- mpfr_limb_ptr tmp;
/* first, check if p is correct */
MPFR_ASSERTN (MPFR_PREC_COND (p));
@@ -38,8 +37,12 @@ mpfr_set_prec (mpfr_ptr x, mpfr_prec_t p)
xoldsize = MPFR_GET_ALLOC_SIZE (x);
if (xsize > xoldsize)
{
- tmp = (mpfr_limb_ptr) (*__gmp_reallocate_func)
- (MPFR_GET_REAL_PTR(x), MPFR_MALLOC_SIZE(xoldsize), MPFR_MALLOC_SIZE(xsize));
+ mpfr_size_limb_t *tmp;
+
+ tmp = (mpfr_size_limb_t *) (*__gmp_reallocate_func)
+ (MPFR_GET_REAL_PTR(x),
+ MPFR_MALLOC_SIZE(xoldsize),
+ MPFR_MALLOC_SIZE(xsize));
MPFR_SET_MANT_PTR(x, tmp);
MPFR_SET_ALLOC_SIZE(x, xsize);
}