summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-09 16:54:36 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2020-03-09 16:54:36 +0100
commit6c61dad70c43eb99e2bc33707d8bf04414541824 (patch)
treeaeee32a0f64e9a3afe1b97d30614a4531b73a747 /mpz
parent15b2a12c59eedf627df7f536ecb84d865c25f67d (diff)
downloadgmp-6c61dad70c43eb99e2bc33707d8bf04414541824.tar.gz
mpz/bin_ui.c (rek_raising_fac4): Reduce allocations
Diffstat (limited to 'mpz')
-rw-r--r--mpz/bin_ui.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/mpz/bin_ui.c b/mpz/bin_ui.c
index bab3e0769..143e2988c 100644
--- a/mpz/bin_ui.c
+++ b/mpz/bin_ui.c
@@ -146,22 +146,17 @@ rek_raising_fac4 (mpz_ptr r, mpz_ptr p, mpz_ptr P, unsigned long int k, unsigned
mpz_t lt;
unsigned long int m;
+ ALLOC (lt) = 0;
+ SIZ (lt) = 0;
+ if (t == NULL)
+ t = lt;
m = ((k + lk) >> 1) + 1;
rek_raising_fac4 (r, p, P, k, m, t);
posmpz_inc_ui (p, 4*m+2);
mpz_addmul_ui (P, p, 4*m);
posmpz_dec_ui (P, m);
- if (t == NULL)
- {
- mpz_init_set (lt, P);
- t = lt;
- }
- else
- {
- ALLOC (lt) = 0;
- mpz_set (t, P);
- }
+ mpz_set (t, P);
rek_raising_fac4 (t, p, P, m - 1, lk, NULL);
mpz_mul (r, r, t);