summaryrefslogtreecommitdiff
path: root/mpq
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2012-06-08 21:54:49 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2012-06-08 21:54:49 +0200
commitd278771c99ea01862912a8bb2d074ed26798992e (patch)
treed283f61612e80d0bc072deb689192c57a367f1d7 /mpq
parent621a1088c537d37f9c4e252d598436da428d067d (diff)
downloadgmp-d278771c99ea01862912a8bb2d074ed26798992e.tar.gz
(MPZ_NEWALLOC): New macro. Use it in mpq and some mpz.
Diffstat (limited to 'mpq')
-rw-r--r--mpq/abs.c4
-rw-r--r--mpq/get_den.c2
-rw-r--r--mpq/get_num.c2
-rw-r--r--mpq/inv.c4
-rw-r--r--mpq/neg.c4
-rw-r--r--mpq/set.c4
-rw-r--r--mpq/set_d.c6
-rw-r--r--mpq/set_den.c2
-rw-r--r--mpq/set_f.c6
-rw-r--r--mpq/set_num.c2
-rw-r--r--mpq/set_z.c2
11 files changed, 19 insertions, 19 deletions
diff --git a/mpq/abs.c b/mpq/abs.c
index 262eda33b..3f0caeba9 100644
--- a/mpq/abs.c
+++ b/mpq/abs.c
@@ -33,10 +33,10 @@ mpq_abs (mpq_ptr dst, mpq_srcptr src)
mp_size_t den_size = SIZ(DEN(src));
mp_ptr dp;
- dp = MPZ_REALLOC (NUM(dst), num_abs_size);
+ dp = MPZ_NEWALLOC (NUM(dst), num_abs_size);
MPN_COPY (dp, PTR(NUM(src)), num_abs_size);
- dp = MPZ_REALLOC (DEN(dst), den_size);
+ dp = MPZ_NEWALLOC (DEN(dst), den_size);
SIZ(DEN(dst)) = den_size;
MPN_COPY (dp, PTR(DEN(src)), den_size);
}
diff --git a/mpq/get_den.c b/mpq/get_den.c
index 19d0fcd45..6a969dfe3 100644
--- a/mpq/get_den.c
+++ b/mpq/get_den.c
@@ -26,7 +26,7 @@ mpq_get_den (mpz_ptr den, mpq_srcptr src)
mp_size_t size = SIZ(DEN(src));
mp_ptr dp;
- dp = MPZ_REALLOC (den, size);
+ dp = MPZ_NEWALLOC (den, size);
SIZ(den) = size;
MPN_COPY (dp, PTR(DEN(src)), size);
}
diff --git a/mpq/get_num.c b/mpq/get_num.c
index 2029ff7c4..bbc6448fd 100644
--- a/mpq/get_num.c
+++ b/mpq/get_num.c
@@ -27,7 +27,7 @@ mpq_get_num (mpz_ptr num, mpq_srcptr src)
mp_size_t abs_size = ABS (size);
mp_ptr dp;
- dp = MPZ_REALLOC (num, abs_size);
+ dp = MPZ_NEWALLOC (num, abs_size);
SIZ(num) = size;
MPN_COPY (dp, PTR(NUM(src)), abs_size);
diff --git a/mpq/inv.c b/mpq/inv.c
index 0c6b5e8f1..48f0ae75f 100644
--- a/mpq/inv.c
+++ b/mpq/inv.c
@@ -51,10 +51,10 @@ mpq_inv (mpq_ptr dest, mpq_srcptr src)
mp_ptr dp;
den_size = ABS (den_size);
- dp = MPZ_REALLOC (NUM(dest), den_size);
+ dp = MPZ_NEWALLOC (NUM(dest), den_size);
MPN_COPY (dp, PTR(DEN(src)), den_size);
- dp = MPZ_REALLOC (DEN(dest), num_size);
+ dp = MPZ_NEWALLOC (DEN(dest), num_size);
MPN_COPY (dp, PTR(NUM(src)), num_size);
}
}
diff --git a/mpq/neg.c b/mpq/neg.c
index a292cced2..32115c2fc 100644
--- a/mpq/neg.c
+++ b/mpq/neg.c
@@ -34,11 +34,11 @@ mpq_neg (mpq_ptr dst, mpq_srcptr src)
mp_ptr dp;
size = ABS(num_size);
- dp = MPZ_REALLOC (NUM(dst), size);
+ dp = MPZ_NEWALLOC (NUM(dst), size);
MPN_COPY (dp, PTR(NUM(src)), size);
size = SIZ(DEN(src));
- dp = MPZ_REALLOC (DEN(dst), size);
+ dp = MPZ_NEWALLOC (DEN(dst), size);
SIZ(DEN(dst)) = size;
MPN_COPY (dp, PTR(DEN(src)), size);
}
diff --git a/mpq/set.c b/mpq/set.c
index cba41701c..b2dad7e59 100644
--- a/mpq/set.c
+++ b/mpq/set.c
@@ -29,12 +29,12 @@ mpq_set (mpq_ptr dest, mpq_srcptr src)
num_size = SIZ(NUM(src));
abs_num_size = ABS (num_size);
- dp = MPZ_REALLOC (NUM(dest), abs_num_size);
+ dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
SIZ(NUM(dest)) = num_size;
MPN_COPY (dp, PTR(NUM(src)), abs_num_size);
den_size = SIZ(DEN(src));
- dp = MPZ_REALLOC (DEN(dest), den_size);
+ dp = MPZ_NEWALLOC (DEN(dest), den_size);
SIZ(DEN(dest)) = den_size;
MPN_COPY (dp, PTR(DEN(src)), den_size);
}
diff --git a/mpq/set_d.c b/mpq/set_d.c
index 1936587a6..c56ef5d69 100644
--- a/mpq/set_d.c
+++ b/mpq/set_d.c
@@ -71,7 +71,7 @@ mpq_set_d (mpq_ptr dest, double d)
}
dn = -exp;
- np = MPZ_REALLOC (NUM(dest), 3);
+ np = MPZ_NEWALLOC (NUM(dest), 3);
#if LIMBS_PER_DOUBLE == 4
if ((tp[0] | tp[1] | tp[2]) == 0)
np[0] = tp[3], nn = 1;
@@ -98,7 +98,7 @@ mpq_set_d (mpq_ptr dest, double d)
#endif
dn += nn + 1;
ASSERT_ALWAYS (dn > 0);
- dp = MPZ_REALLOC (DEN(dest), dn);
+ dp = MPZ_NEWALLOC (DEN(dest), dn);
MPN_ZERO (dp, dn - 1);
dp[dn - 1] = 1;
count_trailing_zeros (c, np[0] | dp[0]);
@@ -115,7 +115,7 @@ mpq_set_d (mpq_ptr dest, double d)
else
{
nn = exp;
- np = MPZ_REALLOC (NUM(dest), nn);
+ np = MPZ_NEWALLOC (NUM(dest), nn);
switch (nn)
{
default:
diff --git a/mpq/set_den.c b/mpq/set_den.c
index 45828c503..e9ee17b71 100644
--- a/mpq/set_den.c
+++ b/mpq/set_den.c
@@ -28,7 +28,7 @@ mpq_set_den (mpq_ptr dest, mpz_srcptr den)
mp_size_t abs_size = ABS (size);
mp_ptr dp;
- dp = MPZ_REALLOC (DEN(dest), abs_size);
+ dp = MPZ_NEWALLOC (DEN(dest), abs_size);
SIZ(DEN(dest)) = size;
MPN_COPY (dp, PTR(den), abs_size);
diff --git a/mpq/set_f.c b/mpq/set_f.c
index c62b3c63b..d1e14867b 100644
--- a/mpq/set_f.c
+++ b/mpq/set_f.c
@@ -49,7 +49,7 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
/* radix point is to the right of the limbs, no denominator */
mp_ptr num_ptr;
- num_ptr = MPZ_REALLOC (mpq_numref (q), fexp);
+ num_ptr = MPZ_NEWALLOC (mpq_numref (q), fexp);
MPN_ZERO (num_ptr, fexp - abs_fsize);
MPN_COPY (num_ptr + fexp - abs_fsize, fptr, abs_fsize);
@@ -64,8 +64,8 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
mp_size_t den_size;
den_size = abs_fsize - fexp;
- num_ptr = MPZ_REALLOC (mpq_numref (q), abs_fsize);
- den_ptr = MPZ_REALLOC (mpq_denref (q), den_size+1);
+ num_ptr = MPZ_NEWALLOC (mpq_numref (q), abs_fsize);
+ den_ptr = MPZ_NEWALLOC (mpq_denref (q), den_size+1);
if (flow & 1)
{
diff --git a/mpq/set_num.c b/mpq/set_num.c
index 4643a7213..5b018c808 100644
--- a/mpq/set_num.c
+++ b/mpq/set_num.c
@@ -27,7 +27,7 @@ mpq_set_num (mpq_ptr dest, mpz_srcptr num)
mp_size_t abs_size = ABS (size);
mp_ptr dp;
- dp = MPZ_REALLOC (NUM(dest), abs_size);
+ dp = MPZ_NEWALLOC (NUM(dest), abs_size);
SIZ(NUM(dest)) = size;
MPN_COPY (dp, PTR(num), abs_size);
diff --git a/mpq/set_z.c b/mpq/set_z.c
index bda176db3..e6f3ff0b6 100644
--- a/mpq/set_z.c
+++ b/mpq/set_z.c
@@ -29,7 +29,7 @@ mpq_set_z (mpq_ptr dest, mpz_srcptr src)
num_size = SIZ (src);
abs_num_size = ABS (num_size);
- dp = MPZ_REALLOC (NUM(dest), abs_num_size);
+ dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
SIZ(NUM(dest)) = num_size;
MPN_COPY (dp, PTR(src), abs_num_size);