diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-11-09 22:30:52 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-11-09 22:30:52 +0100 |
commit | 7acd63c08b3b969696681ee8125ea63e543998c8 (patch) | |
tree | fccdc23ceb50b4647ac4dd5848c9170972c3030d /mpz/bin_uiui.c | |
parent | e97517c73c6a962a9d2cd519adcc639087cd1a75 (diff) | |
download | gmp-7acd63c08b3b969696681ee8125ea63e543998c8.tar.gz |
mpz: Lazy allocation.
Diffstat (limited to 'mpz/bin_uiui.c')
-rw-r--r-- | mpz/bin_uiui.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mpz/bin_uiui.c b/mpz/bin_uiui.c index 94a9dc5c7..9d661d54e 100644 --- a/mpz/bin_uiui.c +++ b/mpz/bin_uiui.c @@ -642,7 +642,7 @@ mpz_goetgheluck_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k) } else { - PTR (r)[0] = prod; + MPZ_NEWALLOC (r, 1)[0] = prod; SIZ (r) = 1; } TMP_FREE; @@ -677,10 +677,10 @@ mpz_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k) /* Rewrite bin(n,k) as bin(n,n-k) if that is smaller. */ k = MIN (k, n - k); if (k < 2) { - PTR(r)[0] = k ? n : 1; /* 1 + ((-k) & (n-1)); */ + MPZ_NEWALLOC (r, 1)[0] = k ? n : 1; /* 1 + ((-k) & (n-1)); */ SIZ(r) = 1; } else if (n <= ODD_FACTORIAL_EXTTABLE_LIMIT) { /* k >= 2, n >= 4 */ - PTR(r)[0] = bc_bin_uiui (n, k); + MPZ_NEWALLOC (r, 1)[0] = bc_bin_uiui (n, k); SIZ(r) = 1; } else if (k <= ODD_FACTORIAL_TABLE_LIMIT) mpz_smallk_bin_uiui (r, n, k); |