[Gmp-commit] /var/hg/gmp: mpn/generic/invert.c: Remove support for scratch ==...
mercurial at gmplib.org
mercurial at gmplib.org
Sat Apr 14 09:55:20 CEST 2012
details: /var/hg/gmp/rev/e1596f0d37c3
changeset: 14818:e1596f0d37c3
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Sat Apr 14 09:55:15 2012 +0200
description:
mpn/generic/invert.c: Remove support for scratch == NULL.
diffstat:
ChangeLog | 4 ++++
mpn/generic/invert.c | 7 -------
tune/speed.h | 7 ++++---
3 files changed, 8 insertions(+), 10 deletions(-)
diffs (63 lines):
diff -r e68f8fefe22d -r e1596f0d37c3 ChangeLog
--- a/ChangeLog Fri Apr 13 23:21:11 2012 +0200
+++ b/ChangeLog Sat Apr 14 09:55:15 2012 +0200
@@ -9,6 +9,10 @@
* tests/mpz/t-fac_ui.c: Check Wilson's theorem on a big value.
+ * mpn/generic/invert.c: Remove support for scratch == NULL.
+ * tune/speed.h (SPEED_ROUTINE_MPN_MUPI_DIV_QR): Allocate scratch
+ space for mpn_invert.
+
2012-04-12 Torbjorn Granlund <tege at gmplib.org>
* mpn/x86_64/fastsse/lshift-movdqu2.asm: New file.
diff -r e68f8fefe22d -r e1596f0d37c3 mpn/generic/invert.c
--- a/mpn/generic/invert.c Fri Apr 13 23:21:11 2012 +0200
+++ b/mpn/generic/invert.c Sat Apr 14 09:55:15 2012 +0200
@@ -23,10 +23,6 @@
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-/* FIXME: Remove NULL and TMP_*, as soon as all the callers properly
- allocate and pass the scratch to the function. */
-#include <stdlib.h> /* for NULL */
-
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -46,9 +42,6 @@
TMP_DECL;
TMP_MARK;
- if (scratch == NULL)
- scratch = TMP_ALLOC_LIMBS (mpn_invert_itch (n));
-
if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD))
{
/* Maximum scratch needed by this branch: 2*n */
diff -r e68f8fefe22d -r e1596f0d37c3 tune/speed.h
--- a/tune/speed.h Fri Apr 13 23:21:11 2012 +0200
+++ b/tune/speed.h Sat Apr 14 09:55:15 2012 +0200
@@ -1865,9 +1865,9 @@
#define SPEED_ROUTINE_MPN_MUPI_DIV_QR(function,itchfn) \
{ \
unsigned i; \
- mp_ptr dp, tp, qp, rp, ip, scratch; \
+ mp_ptr dp, tp, qp, rp, ip, scratch, tmp; \
double t; \
- mp_size_t size1, itch; \
+ mp_size_t size1, itch; \
TMP_DECL; \
\
size1 = (s->r == 0 ? 2 * s->size : s->r); \
@@ -1894,7 +1894,8 @@
dp[s->size-1] |= GMP_NUMB_HIGHBIT; \
tp[size1 - 1] = dp[s->size-1] - 1; \
\
- mpn_invert (ip, dp, s->size, NULL); \
+ tmp = TMP_ALLOC_LIMBS (mpn_invert_itch (s->size)); \
+ mpn_invert (ip, dp, s->size, tmp); \
\
speed_operand_dst (s, qp, size1 - s->size); \
speed_operand_dst (s, rp, s->size); \
More information about the gmp-commit
mailing list