[Gmp-commit] /var/hg/gmp: mini-gmp/mini-gmp.c (mpz_mul_ui, mpz_mul, mpz_div_q...
mercurial at gmplib.org
mercurial at gmplib.org
Sat Jan 12 12:09:34 CET 2013
details: /var/hg/gmp/rev/e60d1a18d8a9
changeset: 15260:e60d1a18d8a9
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Jan 12 12:09:23 2013 +0100
description:
mini-gmp/mini-gmp.c (mpz_mul_ui, mpz_mul, mpz_div_qr): Replace init+REALLOC with init2.
diffstat:
ChangeLog | 1 +
mini-gmp/mini-gmp.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
diffs (51 lines):
diff -r 5fcc2ca00c74 -r e60d1a18d8a9 ChangeLog
--- a/ChangeLog Fri Jan 11 10:37:20 2013 +0100
+++ b/ChangeLog Sat Jan 12 12:09:23 2013 +0100
@@ -5,6 +5,7 @@
* mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-comb.
* mini-gmp/mini-gmp.c (mpz_mul_si): Simplify.
+ (mpz_mul_ui, mpz_mul, mpz_div_qr): Replace init+REALLOC with init2.
2013-01-10 Marco Bodrato <bodrato at mail.dm.unipi.it>
diff -r 5fcc2ca00c74 -r e60d1a18d8a9 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c Fri Jan 11 10:37:20 2013 +0100
+++ b/mini-gmp/mini-gmp.c Sat Jan 12 12:09:23 2013 +0100
@@ -1931,9 +1931,9 @@
return;
}
- mpz_init (t);
-
- tp = MPZ_REALLOC (t, un + 1);
+ mpz_init2 (t, (un + 1) * GMP_LIMB_BITS);
+
+ tp = t->_mp_d;
cy = mpn_mul_1 (tp, u->_mp_d, un, v);
tp[un] = cy;
@@ -1964,9 +1964,9 @@
sign = (u->_mp_size ^ v->_mp_size) < 0;
- mpz_init (t);
-
- tp = MPZ_REALLOC (t, un + vn);
+ mpz_init2 (t, (un + vn) * GMP_LIMB_BITS);
+
+ tp = t->_mp_d;
if (un >= vn)
mpn_mul (tp, u->_mp_d, un, v->_mp_d, vn);
else
@@ -2087,8 +2087,8 @@
if (q)
{
- mpz_init (tq);
- qp = MPZ_REALLOC (tq, qn);
+ mpz_init2 (tq, qn * GMP_LIMB_BITS);
+ qp = tq->_mp_d;
}
else
qp = NULL;
More information about the gmp-commit
mailing list