[Gmp-commit] /home/hgfiles/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sat Jan 8 12:43:45 CET 2011


details:   /home/hgfiles/gmp/rev/95f8a1f3bbe7
changeset: 13730:95f8a1f3bbe7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Tue Jan 04 15:50:39 2011 +0100
description:
Remove cycle counts.

details:   /home/hgfiles/gmp/rev/e3d062d8ead1
changeset: 13731:e3d062d8ead1
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Tue Jan 04 15:51:02 2011 +0100
description:
Remove obsolete comment.

details:   /home/hgfiles/gmp/rev/940aa0d2c5c7
changeset: 13732:940aa0d2c5c7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Jan 08 12:43:40 2011 +0100
description:
Trivial merge.

diffstat:

 ChangeLog                      |  11 +++++++
 doc/gmp.texi                   |   5 +-
 mpn/powerpc32/vmx/popcount.asm |   5 ---
 mpn/powerpc64/vmx/popcount.asm |   3 -
 mpz/aors.h                     |  38 ++++++------------------
 mpz/cmp.c                      |  10 +-----
 mpz/gcd.c                      |  65 ++++++++++++++++++-----------------------
 mpz/mul.c                      |  17 +++-------
 mpz/powm.c                     |  11 +-----
 mpz/set.c                      |  25 +++------------
 mpz/sqrtrem.c                  |  39 ++++++++++--------------
 mpz/tdiv_qr.c                  |  10 +-----
 12 files changed, 87 insertions(+), 152 deletions(-)

diffs (truncated from 582 to 300 lines):

diff -r 24e39d57f1e7 -r 940aa0d2c5c7 ChangeLog
--- a/ChangeLog	Tue Dec 28 16:28:41 2010 +0100
+++ b/ChangeLog	Sat Jan 08 12:43:40 2011 +0100
@@ -1,3 +1,14 @@
+2011-01-03 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpz/aors.h: Remove #ifdef BERKELEY_MP, and cleanup.
+	* mpz/cmp.c: Likewise.
+	* mpz/gcd.c: Likewise.
+	* mpz/mul.c: Likewise.
+	* mpz/powm.c: Likewise.
+	* mpz/set.c: Likewise.
+	* mpz/sqrtrem.c: Likewise.
+	* mpz/tdiv_qr.c: Likewise.
+
 2010-12-28  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/minithres/gmp-mparam.h: Update with several recent thresholds.
diff -r 24e39d57f1e7 -r 940aa0d2c5c7 doc/gmp.texi
--- a/doc/gmp.texi	Tue Dec 28 16:28:41 2010 +0100
+++ b/doc/gmp.texi	Sat Jan 08 12:43:40 2011 +0100
@@ -15,7 +15,8 @@
 arithmetic library, version @value{VERSION}.
 
 Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document under
 the terms of the GNU Free Documentation License, Version 1.3 or any later
@@ -8393,7 +8394,7 @@
 resulting matrix is applied to the inputs using @code{mpn_mul_1} and
 @code{mpn_submul_1}. Each iteration usually reduces the inputs by almost one
 limb. In the rare case of a large quotient, no progress can be made by
-examining just the most significant two limbs, and the quotient is computing
+examining just the most significant two limbs, and the quotient is computed
 using plain division.
 
 The resulting algorithm is asymptotically @math{O(N^2)}, just as the Euclidean
diff -r 24e39d57f1e7 -r 940aa0d2c5c7 mpn/powerpc32/vmx/popcount.asm
--- a/mpn/powerpc32/vmx/popcount.asm	Tue Dec 28 16:28:41 2010 +0100
+++ b/mpn/powerpc32/vmx/popcount.asm	Sat Jan 08 12:43:40 2011 +0100
@@ -21,8 +21,3 @@
 
 MULFUNC_PROLOGUE(mpn_popcount)
 include_mpn(`powerpc64/vmx/popcount.asm')
-
-C                   cycles/limb
-C 7400,7410 (G4):       2.75
-C 744x,745x (G4+):      2.25
-C 970 (G5):             5.3
diff -r 24e39d57f1e7 -r 940aa0d2c5c7 mpn/powerpc64/vmx/popcount.asm
--- a/mpn/powerpc64/vmx/popcount.asm	Tue Dec 28 16:28:41 2010 +0100
+++ b/mpn/powerpc64/vmx/popcount.asm	Sat Jan 08 12:43:40 2011 +0100
@@ -24,9 +24,6 @@
 C 744x,745x (G4+):      1.125
 C 970 (G5):             2.25
 
-C STATUS
-C  * Works for all sizes and alignments.
-
 C TODO
 C  * Rewrite the awkward huge n outer loop code.
 C  * Two lvx, two vperm, and two vxor could make us a similar hamdist.
diff -r 24e39d57f1e7 -r 940aa0d2c5c7 mpz/aors.h
--- a/mpz/aors.h	Tue Dec 28 16:28:41 2010 +0100
+++ b/mpz/aors.h	Sat Jan 08 12:43:40 2011 +0100
@@ -1,6 +1,7 @@
 /* mpz_add, mpz_sub -- add or subtract integers.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2011 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -21,21 +22,6 @@
 #include "gmp-impl.h"
 
 
-#ifdef BERKELEY_MP
-
-#include "mp.h"
-#ifdef OPERATION_add
-#define FUNCTION     madd
-#define VARIATION
-#endif
-#ifdef OPERATION_sub
-#define FUNCTION     msub
-#define VARIATION    -
-#endif
-#define ARGUMENTS    mpz_srcptr u, mpz_srcptr v, mpz_ptr w
-
-#else /* normal GMP */
-
 #ifdef OPERATION_add
 #define FUNCTION     mpz_add
 #define VARIATION
@@ -44,9 +30,6 @@
 #define FUNCTION     mpz_sub
 #define VARIATION    -
 #endif
-#define ARGUMENTS    mpz_ptr w, mpz_srcptr u, mpz_srcptr v
-
-#endif
 
 #ifndef FUNCTION
 Error, need OPERATION_add or OPERATION_sub
@@ -54,7 +37,7 @@
 
 
 void
-FUNCTION (ARGUMENTS)
+FUNCTION (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
 {
   mp_srcptr up, vp;
   mp_ptr wp;
@@ -62,8 +45,8 @@
   mp_size_t abs_usize;
   mp_size_t abs_vsize;
 
-  usize = u->_mp_size;
-  vsize = VARIATION v->_mp_size;
+  usize = SIZ(u);
+  vsize = VARIATION SIZ(v);
   abs_usize = ABS (usize);
   abs_vsize = ABS (vsize);
 
@@ -79,13 +62,12 @@
 
   /* If not space for w (and possible carry), increase space.  */
   wsize = abs_usize + 1;
-  if (w->_mp_alloc < wsize)
-    _mpz_realloc (w, wsize);
+  MPZ_REALLOC (w, wsize);
 
   /* These must be after realloc (u or v may be the same as w).  */
-  up = u->_mp_d;
-  vp = v->_mp_d;
-  wp = w->_mp_d;
+  up = PTR(u);
+  vp = PTR(v);
+  wp = PTR(w);
 
   if ((usize ^ vsize) < 0)
     {
@@ -128,5 +110,5 @@
 	wsize = -wsize;
     }
 
-  w->_mp_size = wsize;
+  SIZ(w) = wsize;
 }
diff -r 24e39d57f1e7 -r 940aa0d2c5c7 mpz/cmp.c
--- a/mpz/cmp.c	Tue Dec 28 16:28:41 2010 +0100
+++ b/mpz/cmp.c	Sat Jan 08 12:43:40 2011 +0100
@@ -1,7 +1,8 @@
 /* mpz_cmp(u,v) -- Compare U, V.  Return positive, zero, or negative
    based on if U > V, U == V, or U < V.
 
-Copyright 1991, 1993, 1994, 1996, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2011 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -18,18 +19,11 @@
 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/.  */
 
-#ifdef BERKELEY_MP
-#include "mp.h"
-#endif
 #include "gmp.h"
 #include "gmp-impl.h"
 
 int
-#ifdef BERKELEY_MP
-mcmp (mpz_srcptr u, mpz_srcptr v)
-#else
 mpz_cmp (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
-#endif
 {
   mp_size_t  usize, vsize, dsize, asize;
   mp_srcptr  up, vp;
diff -r 24e39d57f1e7 -r 940aa0d2c5c7 mpz/gcd.c
--- a/mpz/gcd.c	Tue Dec 28 16:28:41 2010 +0100
+++ b/mpz/gcd.c	Sat Jan 08 12:43:40 2011 +0100
@@ -1,7 +1,7 @@
 /* mpz/gcd.c:   Calculate the greatest common divisor of two integers.
 
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2005 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2005, 2010 Free
+Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -21,63 +21,58 @@
 #include "gmp.h"
 #include "gmp-impl.h"
 #include "longlong.h"
-#ifdef BERKELEY_MP
-#include "mp.h"
-#endif
 
 
 void
-#ifndef BERKELEY_MP
 mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
-#else /* BERKELEY_MP */
-gcd (mpz_srcptr u, mpz_srcptr v, mpz_ptr g)
-#endif /* BERKELEY_MP */
 {
   unsigned long int g_zero_bits, u_zero_bits, v_zero_bits;
   mp_size_t g_zero_limbs, u_zero_limbs, v_zero_limbs;
   mp_ptr tp;
-  mp_ptr up = u->_mp_d;
-  mp_size_t usize = ABS (u->_mp_size);
-  mp_ptr vp = v->_mp_d;
-  mp_size_t vsize = ABS (v->_mp_size);
+  mp_ptr up;
+  mp_size_t usize;
+  mp_ptr vp;
+  mp_size_t vsize;
   mp_size_t gsize;
   TMP_DECL;
 
+  up = PTR(u);
+  usize = ABSIZ (u);
+  vp = PTR(v);
+  vsize = ABSIZ (v);
   /* GCD(0, V) == V.  */
   if (usize == 0)
     {
-      g->_mp_size = vsize;
+      SIZ (g) = vsize;
       if (g == v)
 	return;
-      if (g->_mp_alloc < vsize)
-	_mpz_realloc (g, vsize);
-      MPN_COPY (g->_mp_d, vp, vsize);
+      MPZ_REALLOC (g, vsize);
+      MPN_COPY (PTR (g), vp, vsize);
       return;
     }
 
   /* GCD(U, 0) == U.  */
   if (vsize == 0)
     {
-      g->_mp_size = usize;
+      SIZ (g) = usize;
       if (g == u)
 	return;
-      if (g->_mp_alloc < usize)
-	_mpz_realloc (g, usize);
-      MPN_COPY (g->_mp_d, up, usize);
+      MPZ_REALLOC (g, usize);
+      MPN_COPY (PTR (g), up, usize);
       return;
     }
 
   if (usize == 1)
     {
-      g->_mp_size = 1;
-      g->_mp_d[0] = mpn_gcd_1 (vp, vsize, up[0]);
+      SIZ (g) = 1;
+      PTR (g)[0] = mpn_gcd_1 (vp, vsize, up[0]);
       return;
     }
 
   if (vsize == 1)
     {
-      g->_mp_size = 1;
-      g->_mp_d[0] = mpn_gcd_1 (up, usize, vp[0]);
+      SIZ(g) = 1;
+      PTR (g)[0] = mpn_gcd_1 (up, usize, vp[0]);
       return;
     }
 
@@ -86,7 +81,7 @@
   /*  Eliminate low zero bits from U and V and move to temporary storage.  */
   while (*up == 0)
     up++;
-  u_zero_limbs = up - u->_mp_d;
+  u_zero_limbs = up - PTR(u);
   usize -= u_zero_limbs;
   count_trailing_zeros (u_zero_bits, *up);
   tp = up;
@@ -101,7 +96,7 @@
 
   while (*vp == 0)
     vp++;
-  v_zero_limbs = vp - v->_mp_d;
+  v_zero_limbs = vp - PTR (v);
   vsize -= v_zero_limbs;
   count_trailing_zeros (v_zero_bits, *vp);
   tp = vp;
@@ -141,23 +136,21 @@


More information about the gmp-commit mailing list