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/tdiv_qr_ui.c | |
parent | e97517c73c6a962a9d2cd519adcc639087cd1a75 (diff) | |
download | gmp-7acd63c08b3b969696681ee8125ea63e543998c8.tar.gz |
mpz: Lazy allocation.
Diffstat (limited to 'mpz/tdiv_qr_ui.c')
-rw-r--r-- | mpz/tdiv_qr_ui.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mpz/tdiv_qr_ui.c b/mpz/tdiv_qr_ui.c index 4f667abe0..1385fc9a8 100644 --- a/mpz/tdiv_qr_ui.c +++ b/mpz/tdiv_qr_ui.c @@ -68,7 +68,7 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in SIZ(quot) = 0; rl = np[0]; SIZ(rem) = ns >= 0 ? 1 : -1; - PTR(rem)[0] = rl; + MPZ_NEWALLOC (rem, 1)[0] = rl; return rl; } @@ -90,10 +90,8 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in SIZ(rem) = 0; else { - /* Store the single-limb remainder. We don't check if there's space - for just one limb, since no function ever makes zero space. */ SIZ(rem) = ns >= 0 ? 1 : -1; - PTR(rem)[0] = rl; + MPZ_NEWALLOC (rem, 1)[0] = rl; } qn = nn - (qp[nn - 1] == 0); } |