summaryrefslogtreecommitdiff
path: root/mpz/powm_ui.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/powm_ui.c
parente97517c73c6a962a9d2cd519adcc639087cd1a75 (diff)
downloadgmp-7acd63c08b3b969696681ee8125ea63e543998c8.tar.gz
mpz: Lazy allocation.
Diffstat (limited to 'mpz/powm_ui.c')
-rw-r--r--mpz/powm_ui.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mpz/powm_ui.c b/mpz/powm_ui.c
index e04bb0ad7..046895cbe 100644
--- a/mpz/powm_ui.c
+++ b/mpz/powm_ui.c
@@ -140,8 +140,8 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
{
/* Exponent is zero, result is 1 mod M, i.e., 1 or 0 depending on if
M equals 1. */
- SIZ(r) = (mn == 1 && mp[0] == 1) ? 0 : 1;
- PTR(r)[0] = 1;
+ SIZ(r) = mn != 1 || mp[0] != 1;
+ MPZ_NEWALLOC (r, 1)[0] = 1;
return;
}