[Gmp-commit] /var/hg/gmp: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sun Jan 19 11:22:01 UTC 2014
details: /var/hg/gmp/rev/b9fef46d0dd4
changeset: 16206:b9fef46d0dd4
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:20:11 2014 +0100
description:
Call __gmp_free_func ourselves instead of via mpz_clears.
details: /var/hg/gmp/rev/07e3ec022e53
changeset: 16207:07e3ec022e53
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:20:25 2014 +0100
description:
Add cast to avoid overflow of (later ignored) argument.
details: /var/hg/gmp/rev/36e131f0de37
changeset: 16208:36e131f0de37
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:20:37 2014 +0100
description:
ChangeLog
details: /var/hg/gmp/rev/fc71b24e6ac3
changeset: 16209:fc71b24e6ac3
user: Torbjorn Granlund <tege at gmplib.org>
date: Sun Jan 19 12:21:59 2014 +0100
description:
Trivial merge.
diffstat:
ChangeLog | 10 +++++++++-
mini-gmp/mini-gmp.c | 40 ++++++++++++++++++++++++++++++++++++++++
mini-gmp/mini-gmp.h | 4 ++++
mpz/clear.c | 5 +++--
mpz/clears.c | 4 ++--
5 files changed, 58 insertions(+), 5 deletions(-)
diffs (125 lines):
diff -r 5e38be7dad47 -r fc71b24e6ac3 ChangeLog
--- a/ChangeLog Sun Jan 19 11:57:03 2014 +0100
+++ b/ChangeLog Sun Jan 19 12:21:59 2014 +0100
@@ -1,8 +1,16 @@
+2014-01-19 Torbjorn Granlund <tege at gmplib.org>
+
+ * mpz/clears.c: Call __gmp_free_func ourselves instead of via
+ mpz_clears.
+
+ * mpz/clear.c: Add cast to avoid overflow of (later ignored) argument.
+
2014-01-19 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mini-gmp/mini-gmp.c (mpn_popcount): New function.
(mpz_popcount): Use it.
- * mini-gmp/mini-gmp.h: Declare it.
+ (mpz_addmul_ui, mpz_addmul, mpz_submul_ui, mpz_submul): Added.
+ * mini-gmp/mini-gmp.h: Declare them.
2014-01-18 Niels Möller <nisse at lysator.liu.se>
diff -r 5e38be7dad47 -r fc71b24e6ac3 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c Sun Jan 19 11:57:03 2014 +0100
+++ b/mini-gmp/mini-gmp.c Sun Jan 19 12:21:59 2014 +0100
@@ -2021,6 +2021,46 @@
r->_mp_size = (u->_mp_size < 0) ? - rn : rn;
}
+void
+mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+ mpz_t t;
+ mpz_init (t);
+ mpz_mul_ui (t, u, v);
+ mpz_add (r, r, t);
+ mpz_clear (t);
+}
+
+void
+mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
+{
+ mpz_t t;
+ mpz_init (t);
+ mpz_mul_ui (t, u, v);
+ mpz_sub (r, r, t);
+ mpz_clear (t);
+}
+
+void
+mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+ mpz_t t;
+ mpz_init (t);
+ mpz_mul (t, u, v);
+ mpz_add (r, r, t);
+ mpz_clear (t);
+}
+
+void
+mpz_submul (mpz_t r, const mpz_t u, const mpz_t v)
+{
+ mpz_t t;
+ mpz_init (t);
+ mpz_mul (t, u, v);
+ mpz_sub (r, r, t);
+ mpz_clear (t);
+}
+
/* MPZ division */
enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC };
diff -r 5e38be7dad47 -r fc71b24e6ac3 mini-gmp/mini-gmp.h
--- a/mini-gmp/mini-gmp.h Sun Jan 19 11:57:03 2014 +0100
+++ b/mini-gmp/mini-gmp.h Sun Jan 19 12:21:59 2014 +0100
@@ -131,6 +131,10 @@
void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
void mpz_mul (mpz_t, const mpz_t, const mpz_t);
void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
+void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_addmul (mpz_t, const mpz_t, const mpz_t);
+void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int);
+void mpz_submul (mpz_t, const mpz_t, const mpz_t);
void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
diff -r 5e38be7dad47 -r fc71b24e6ac3 mpz/clear.c
--- a/mpz/clear.c Sun Jan 19 11:57:03 2014 +0100
+++ b/mpz/clear.c Sun Jan 19 12:21:59 2014 +0100
@@ -1,7 +1,8 @@
/* mpz_clear -- de-allocate the space occupied by the dynamic digit space of
an integer.
-Copyright 1991, 1993-1995, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993-1995, 2000, 2001, 2012, 2014 Free Software Foundation,
+Inc.
This file is part of the GNU MP Library.
@@ -24,5 +25,5 @@
void
mpz_clear (mpz_ptr m)
{
- (*__gmp_free_func) (PTR (m), ALLOC (m) * BYTES_PER_MP_LIMB);
+ (*__gmp_free_func) (PTR (m), (size_t) ALLOC (m) * BYTES_PER_MP_LIMB);
}
diff -r 5e38be7dad47 -r fc71b24e6ac3 mpz/clears.c
--- a/mpz/clears.c Sun Jan 19 11:57:03 2014 +0100
+++ b/mpz/clears.c Sun Jan 19 12:21:59 2014 +0100
@@ -1,6 +1,6 @@
/* mpz_clears() -- Clear multiple mpz_t variables.
-Copyright 2009 Free Software Foundation, Inc.
+Copyright 2009, 2014 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -49,7 +49,7 @@
while (x != NULL)
{
- mpz_clear (x);
+ (*__gmp_free_func) (PTR (m), (size_t) ALLOC (m) * BYTES_PER_MP_LIMB);
x = va_arg (ap, mpz_ptr);
}
va_end (ap);
More information about the gmp-commit
mailing list