[Gmp-commit] /var/hg/gmp: mpn/generic/toom8h_mul.c: mark UNLIKELY branches.

mercurial at gmplib.org mercurial at gmplib.org
Mon May 28 06:19:43 CEST 2012


details:   /var/hg/gmp/rev/2757606ce063
changeset: 15016:2757606ce063
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon May 28 00:37:51 2012 +0200
description:
mpn/generic/toom8h_mul.c: mark UNLIKELY branches.

diffstat:

 ChangeLog                |  2 ++
 mpn/generic/toom8h_mul.c |  8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 14507dcf670b -r 2757606ce063 ChangeLog
--- a/ChangeLog	Sun May 27 11:00:16 2012 +0200
+++ b/ChangeLog	Mon May 28 00:37:51 2012 +0200
@@ -8,6 +8,8 @@
 
 	* mpn/x86_64/fat/fat.c: abort iff longmode-capable-bit is turned off.
 
+	* mpn/generic/toom8h_mul.c: mark UNLIKELY branches.
+
 2012-05-26  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpz: Use MPZ_REALLOC return value when possible.
diff -r 14507dcf670b -r 2757606ce063 mpn/generic/toom8h_mul.c
--- a/mpn/generic/toom8h_mul.c	Sun May 27 11:00:16 2012 +0200
+++ b/mpn/generic/toom8h_mul.c	Mon May 28 00:37:51 2012 +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 2009, 2010 Free Software Foundation, Inc.
+Copyright 2009, 2010, 2012 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -168,8 +168,8 @@
       t = bn - q * n;
 
       if(half) { /* Recover from badly chosen splitting */
-	if (s<1) {p--; s+=n; half=0;}
-	else if (t<1) {q--; t+=n; half=0;}
+	if (UNLIKELY (s<1)) {p--; s+=n; half=0;}
+	else if (UNLIKELY (t<1)) {q--; t+=n; half=0;}
       }
     }
 #undef LIMIT_numerator
@@ -241,7 +241,7 @@
 
   /* $\pm1$ */
   sign = mpn_toom_eval_pm1 (v2, v0, p, ap, n, s,    pp);
-  if (q == 3)
+  if (GMP_NUMB_BITS > 12*3 && UNLIKELY (q == 3))
     sign ^= mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t,    pp);
   else
     sign ^= mpn_toom_eval_pm1 (v3, v1, q, bp, n, t,    pp);


More information about the gmp-commit mailing list