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

mercurial at gmplib.org mercurial at gmplib.org
Sat Jan 2 10:51:28 CET 2010


details:   /home/hgfiles/gmp/rev/0da2aff3a485
changeset: 13299:0da2aff3a485
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jan 02 10:40:25 2010 +0100
description:
invert: remove duplicated code.

details:   /home/hgfiles/gmp/rev/9e39d2386028
changeset: 13300:9e39d2386028
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jan 02 10:51:14 2010 +0100
description:
Typo (in unused code...)

diffstat:

 ChangeLog                            |   4 ++++
 mpn/generic/invert.c                 |  10 ++++------
 mpn/generic/toom_interpolate_16pts.c |   8 ++++----
 3 files changed, 12 insertions(+), 10 deletions(-)

diffs (71 lines):

diff -r 307df5de3f24 -r 9e39d2386028 ChangeLog
--- a/ChangeLog	Fri Jan 01 23:29:24 2010 +0100
+++ b/ChangeLog	Sat Jan 02 10:51:14 2010 +0100
@@ -1,3 +1,7 @@
+2010-01-02  Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/invert.c: Remove duplicated code.
+
 2010-01-01  Torbjorn Granlund  <tege at gmplib.org>
 
 	* gmp-impl.h (MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD): Default to 0.
diff -r 307df5de3f24 -r 9e39d2386028 mpn/generic/invert.c
--- a/mpn/generic/invert.c	Fri Jan 01 23:29:24 2010 +0100
+++ b/mpn/generic/invert.c	Sat Jan 02 10:51:14 2010 +0100
@@ -32,7 +32,7 @@
 #include "longlong.h"
 
 #ifndef INV_APPR_THRESHOLD
-#define INV_APPR_THRESHOLD (INV_NEWTON_THRESHOLD)
+#define INV_APPR_THRESHOLD INV_NEWTON_THRESHOLD
 #endif
 
 void
@@ -53,10 +53,8 @@
     if (scratch == NULL)
       scratch = TMP_ALLOC_LIMBS (mpn_invert_itch (n));
 
-    if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD)) {
-      if (n == 1)
-	invert_limb (*ip, *dp);
-      else {
+    if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD))
+      {
 	/* Maximum scratch needed by this branch: 2*n */
 	mp_size_t i;
 	mp_ptr xp;
@@ -74,7 +72,7 @@
 	  mpn_sbpi1_div_q (ip, xp, 2 * n, dp, n, inv.inv32);
 	}
       }
-    } else { /* Use approximated inverse; correct the result if needed. */
+    else { /* Use approximated inverse; correct the result if needed. */
       mp_limb_t e; /* The possible error in the approximate inverse */
 
       ASSERT ( mpn_invert_itch (n) >= mpn_invertappr_itch (n) );
diff -r 307df5de3f24 -r 9e39d2386028 mpn/generic/toom_interpolate_16pts.c
--- a/mpn/generic/toom_interpolate_16pts.c	Fri Jan 01 23:29:24 2010 +0100
+++ b/mpn/generic/toom_interpolate_16pts.c	Sat Jan 02 10:51:14 2010 +0100
@@ -123,9 +123,9 @@
 #define BINVERT_255x188513325H CNST_LIMB(0x06DB993A)
 #else /* GMP_NAIL_BITS != 0 */
 #define BINVERT_255x182712915H \
-  (GMP_NUMB_MASK & CNST_LIMB((0x1B649A07<<GMP_NAIL_BITS) || (0x6FC4CB25>>GMP_NUMB_BITS)))
+  (GMP_NUMB_MASK & CNST_LIMB((0x1B649A07<<GMP_NAIL_BITS) | (0x6FC4CB25>>GMP_NUMB_BITS)))
 #define BINVERT_255x188513325H \
-  (GMP_NUMB_MASK & CNST_LIMB((0x06DB993A<<GMP_NAIL_BITS) || (0x6864275B>>GMP_NUMB_BITS)))
+  (GMP_NUMB_MASK & CNST_LIMB((0x06DB993A<<GMP_NAIL_BITS) | (0x6864275B>>GMP_NUMB_BITS)))
 #endif
 #else
 #if GMP_LIMB_BITS == 64
@@ -183,8 +183,8 @@
 
 #ifndef  mpn_divexact_by255x182712915
 #if GMP_NUMB_BITS < 36
-#if HAVE_NATIVE_mpn_bdiv_q_1_pi2 && defined(BINVERT_255x182712915H)
-/* FIXME: use mpn_bdiv_q_1_pi2 */
+#if HAVE_NATIVE_mpn_bdiv_q_2_pi2 && defined(BINVERT_255x182712915H)
+/* FIXME: use mpn_bdiv_q_2_pi2 */
 #endif
 #if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_182712915)
 #define mpn_divexact_by255x182712915(dst,src,size)				\


More information about the gmp-commit mailing list