summaryrefslogtreecommitdiff
path: root/mpz/oddfac_1.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2015-11-09 22:30:52 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2015-11-09 22:30:52 +0100
commit7acd63c08b3b969696681ee8125ea63e543998c8 (patch)
treefccdc23ceb50b4647ac4dd5848c9170972c3030d /mpz/oddfac_1.c
parente97517c73c6a962a9d2cd519adcc639087cd1a75 (diff)
downloadgmp-7acd63c08b3b969696681ee8125ea63e543998c8.tar.gz
mpz: Lazy allocation.
Diffstat (limited to 'mpz/oddfac_1.c')
-rw-r--r--mpz/oddfac_1.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mpz/oddfac_1.c b/mpz/oddfac_1.c
index cf0bff065..cf3178f98 100644
--- a/mpz/oddfac_1.c
+++ b/mpz/oddfac_1.c
@@ -245,6 +245,7 @@ mpz_2multiswing_1 (mpz_ptr x, mp_limb_t n, mp_ptr sieve, mp_ptr factors)
}
else
{
+ ASSERT (ALLOC (x) > 0);
PTR (x)[0] = prod;
SIZ (x) = 1;
}
@@ -290,7 +291,7 @@ mpz_oddfac_1 (mpz_ptr x, mp_limb_t n, unsigned flag)
if (n <= ODD_FACTORIAL_TABLE_LIMIT)
{
- PTR (x)[0] = __gmp_oddfac_table[n];
+ MPZ_NEWALLOC (x, 1)[0] = __gmp_oddfac_table[n];
SIZ (x) = 1;
}
else if (n <= ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1)