[Gmp-commit] /var/hg/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri May 16 07:06:32 UTC 2014


details:   /var/hg/gmp/rev/d5cbb4d49cdc
changeset: 16390:d5cbb4d49cdc
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri May 16 09:03:52 2014 +0200
description:
mpn/generic/toom2*: Avoid a few branches in the odd case.

details:   /var/hg/gmp/rev/1a16bc520aac
changeset: 16391:1a16bc520aac
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri May 16 09:04:16 2014 +0200
description:
Copyright year.

details:   /var/hg/gmp/rev/9468632bcba8
changeset: 16392:9468632bcba8
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri May 16 09:06:22 2014 +0200
description:
ChangeLog

diffstat:

 ChangeLog                |   2 ++
 gen-fib.c                |   2 +-
 gen-psqr.c               |   2 +-
 mpn/generic/toom22_mul.c |  12 ++++++------
 mpn/generic/toom2_sqr.c  |  12 ++++++------
 5 files changed, 16 insertions(+), 14 deletions(-)

diffs (119 lines):

diff -r f62c69d14a37 -r 9468632bcba8 ChangeLog
--- a/ChangeLog	Thu May 15 18:59:16 2014 +0200
+++ b/ChangeLog	Fri May 16 09:06:22 2014 +0200
@@ -6,6 +6,8 @@
 	* gen-psqr.c: Skip even numbers when looking for primes.
 
 	* mpn/generic/invert.c: Avoid a branch.
+	* mpn/generic/toom2_sqr.c: Avoid a few branches in the odd case.
+	* mpn/generic/toom22_mul.c: Likewise.
 
 2014-05-08  Marc Glisse  <marc.glisse at inria.fr>
 
diff -r f62c69d14a37 -r 9468632bcba8 gen-fib.c
--- a/gen-fib.c	Thu May 15 18:59:16 2014 +0200
+++ b/gen-fib.c	Fri May 16 09:06:22 2014 +0200
@@ -1,6 +1,6 @@
 /* Generate Fibonacci table data.
 
-Copyright 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2004, 2012, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
diff -r f62c69d14a37 -r 9468632bcba8 gen-psqr.c
--- a/gen-psqr.c	Thu May 15 18:59:16 2014 +0200
+++ b/gen-psqr.c	Fri May 16 09:06:22 2014 +0200
@@ -1,6 +1,6 @@
 /* Generate perfect square testing data.
 
-Copyright 2002-2004, 2012 Free Software Foundation, Inc.
+Copyright 2002-2004, 2012, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
diff -r f62c69d14a37 -r 9468632bcba8 mpn/generic/toom22_mul.c
--- a/mpn/generic/toom22_mul.c	Thu May 15 18:59:16 2014 +0200
+++ b/mpn/generic/toom22_mul.c	Fri May 16 09:06:22 2014 +0200
@@ -7,7 +7,7 @@
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2006-2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -109,7 +109,7 @@
 
   ASSERT (an >= bn);
 
-  ASSERT (0 < s && s <= n);
+  ASSERT (0 < s && s <= n && s >= n - 1);
   ASSERT (0 < t && t <= s);
 
   asm1 = pp;
@@ -130,17 +130,17 @@
 	  mpn_sub_n (asm1, a0, a1, n);
 	}
     }
-  else
+  else /* n - s == 1 */
     {
-      if (mpn_zero_p (a0 + s, n - s) && mpn_cmp (a0, a1, s) < 0)
+      if (a0[s] == 0 && mpn_cmp (a0, a1, s) < 0)
 	{
 	  mpn_sub_n (asm1, a1, a0, s);
-	  MPN_ZERO (asm1 + s, n - s);
+	  asm1[s] = 0;
 	  vm1_neg = 1;
 	}
       else
 	{
-	  mpn_sub (asm1, a0, n, a1, s);
+	  asm1[s] = a0[s] - mpn_sub_n (asm1, a0, a1, s);
 	}
     }
 
diff -r f62c69d14a37 -r 9468632bcba8 mpn/generic/toom2_sqr.c
--- a/mpn/generic/toom2_sqr.c	Thu May 15 18:59:16 2014 +0200
+++ b/mpn/generic/toom2_sqr.c	Fri May 16 09:06:22 2014 +0200
@@ -6,7 +6,7 @@
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2006-2010, 2012 Free Software Foundation, Inc.
+Copyright 2006-2010, 2012, 2014 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -81,7 +81,7 @@
   s = an >> 1;
   n = an - s;
 
-  ASSERT (0 < s && s <= n);
+  ASSERT (0 < s && s <= n && s >= n - 1);
 
   asm1 = pp;
 
@@ -97,16 +97,16 @@
 	  mpn_sub_n (asm1, a0, a1, n);
 	}
     }
-  else
+  else /* n - s == 1 */
     {
-      if (mpn_zero_p (a0 + s, n - s) && mpn_cmp (a0, a1, s) < 0)
+      if (a0[s] == 0 && mpn_cmp (a0, a1, s) < 0)
 	{
 	  mpn_sub_n (asm1, a1, a0, s);
-	  MPN_ZERO (asm1 + s, n - s);
+	  asm1[s] = 0;
 	}
       else
 	{
-	  mpn_sub (asm1, a0, n, a1, s);
+	  asm1[s] = a0[s] - mpn_sub_n (asm1, a0, a1, s);
 	}
     }
 


More information about the gmp-commit mailing list