summaryrefslogtreecommitdiff
path: root/mpz/powm_ui.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2016-12-28 18:32:48 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2016-12-28 18:32:48 +0100
commit4eb313830acae0a7b7c4be0d15aabe43c6b2356a (patch)
treed6eb19146c123b8cd388cce5299100b78d0391d4 /mpz/powm_ui.c
parenta30ac1457e0f5a5fbb62891ba10edc2235cc8768 (diff)
downloadgmp-4eb313830acae0a7b7c4be0d15aabe43c6b2356a.tar.gz
mpz/powm_ui.c: Use TMP_ALLOC_LIMBS_x macros
Diffstat (limited to 'mpz/powm_ui.c')
-rw-r--r--mpz/powm_ui.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mpz/powm_ui.c b/mpz/powm_ui.c
index 3eb0ca466..69d66187a 100644
--- a/mpz/powm_ui.c
+++ b/mpz/powm_ui.c
@@ -108,8 +108,7 @@ reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn, gmp_p
TMP_DECL;
TMP_MARK;
- rp = TMP_ALLOC_LIMBS (an);
- scratch = TMP_ALLOC_LIMBS (an - mn + 1);
+ TMP_ALLOC_LIMBS_2 (rp, an, scratch, an - mn + 1);
MPN_COPY (rp, ap, an);
mod (rp, an, mp, mn, dinv, scratch);
MPN_COPY (tp, rp, mn);
@@ -182,9 +181,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
return;
}
- tp = TMP_ALLOC_LIMBS (2 * mn + 1);
- xp = TMP_ALLOC_LIMBS (mn);
- scratch = TMP_ALLOC_LIMBS (mn + 1);
+ TMP_ALLOC_LIMBS_3 (xp, mn, scratch, mn + 1, tp, 2 * mn + 1);
MPN_COPY (xp, bp, bn);
xn = bn;
@@ -273,7 +270,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
xn = mn;
MPN_NORMALIZE (xp, xn);
}
- MPZ_REALLOC (r, xn);
+ MPZ_NEWALLOC (r, xn);
SIZ (r) = xn;
MPN_COPY (PTR(r), xp, xn);