summaryrefslogtreecommitdiff
path: root/mpz/gcd.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2016-11-27 07:59:15 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2016-11-27 07:59:15 +0100
commit8864a7cee4d51bd1e0b1bdefb44ecf5db627360a (patch)
tree081d899dfc428350c8d8a4aa701f03f8d89f6ade /mpz/gcd.c
parent3524b440dfce16d91547586907bbec7f302c3f8f (diff)
downloadgmp-8864a7cee4d51bd1e0b1bdefb44ecf5db627360a.tar.gz
mpz/gcd{,ext}.c: Use NEWALLOC.
Diffstat (limited to 'mpz/gcd.c')
-rw-r--r--mpz/gcd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/mpz/gcd.c b/mpz/gcd.c
index a296dda70..9cae9be81 100644
--- a/mpz/gcd.c
+++ b/mpz/gcd.c
@@ -56,8 +56,8 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
SIZ (g) = vsize;
if (g == v)
return;
- MPZ_REALLOC (g, vsize);
- MPN_COPY (PTR (g), vp, vsize);
+ tp = MPZ_NEWALLOC (g, vsize);
+ MPN_COPY (tp, vp, vsize);
return;
}
@@ -67,8 +67,8 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
SIZ (g) = usize;
if (g == u)
return;
- MPZ_REALLOC (g, usize);
- MPN_COPY (PTR (g), up, usize);
+ tp = MPZ_NEWALLOC (g, usize);
+ MPN_COPY (tp, up, usize);
return;
}
@@ -146,19 +146,19 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
{
mp_limb_t cy_limb;
gsize += (vp[vsize - 1] >> (GMP_NUMB_BITS - g_zero_bits)) != 0;
- MPZ_REALLOC (g, gsize);
- MPN_ZERO (PTR (g), g_zero_limbs);
+ tp = MPZ_NEWALLOC (g, gsize);
+ MPN_ZERO (tp, g_zero_limbs);
- tp = PTR(g) + g_zero_limbs;
+ tp = tp + g_zero_limbs;
cy_limb = mpn_lshift (tp, vp, vsize, g_zero_bits);
if (cy_limb != 0)
tp[vsize] = cy_limb;
}
else
{
- MPZ_REALLOC (g, gsize);
- MPN_ZERO (PTR (g), g_zero_limbs);
- MPN_COPY (PTR (g) + g_zero_limbs, vp, vsize);
+ tp = MPZ_NEWALLOC (g, gsize);
+ MPN_ZERO (tp, g_zero_limbs);
+ MPN_COPY (tp + g_zero_limbs, vp, vsize);
}
SIZ (g) = gsize;