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

mercurial at gmplib.org mercurial at gmplib.org
Thu Dec 31 08:36:11 CET 2009


details:   /home/hgfiles/gmp/rev/1f21bbde44f3
changeset: 13277:1f21bbde44f3
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Dec 31 08:34:46 2009 +0100
description:
mulmod: Remove MISUSE check, mark UNLIKELY any unexpected condition.

details:   /home/hgfiles/gmp/rev/8cf99f9e0e45
changeset: 13278:8cf99f9e0e45
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Dec 31 08:36:05 2009 +0100
description:
typo

diffstat:

 ChangeLog                 |   7 ++++++-
 mpn/generic/mulmod_bnm1.c |  21 +++++----------------
 2 files changed, 11 insertions(+), 17 deletions(-)

diffs (59 lines):

diff -r 3b4e5ecc8669 -r 8cf99f9e0e45 ChangeLog
--- a/ChangeLog	Thu Dec 31 01:01:36 2009 +0100
+++ b/ChangeLog	Thu Dec 31 08:36:05 2009 +0100
@@ -1,3 +1,8 @@
+2009-12-31  Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/mulmod_bnm1.c: Don't mention MISUSE any more,
+	simply consider UNLIKELY any unexpected size.
+
 2009-12-31  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tune/tuneup.c (speed_mpn_sbordcpi1_div_qr): New function.
@@ -28,7 +33,7 @@
 	(SPEED_ROUTINE_MPN_MUPI_DIV_QR): New macro.
 	* tune/common.c (speed_mpn_mupi_div_qr): New function.
 
-	* mpn/generic/tdiv_qr.c: Call mpn_mu_bdiv_qr.
+	* mpn/generic/tdiv_qr.c: Call mpn_mu_div_qr.
 
 	* tests/mpz/t-tdiv.c: Use larger test operands.
 
diff -r 3b4e5ecc8669 -r 8cf99f9e0e45 mpn/generic/mulmod_bnm1.c
--- a/mpn/generic/mulmod_bnm1.c	Thu Dec 31 01:01:36 2009 +0100
+++ b/mpn/generic/mulmod_bnm1.c	Thu Dec 31 08:36:05 2009 +0100
@@ -86,16 +86,6 @@
  *
  * S(n) <= rn + 2 + MAX (rn + 2, S(n/2)) <= 2rn + 2 log2 rn + 2
  */
-#define ALLOW_MISUSE 1
-/* If we do not allow misuse, we assume two possible uses:
- * - rn, an, and bn are almost equal: more precisely an > rn/2 and
- *   bn > rn/2
- * - rn = mpn_mulmod_bnm1_next_size(an+bn) > MUL_FFT_MODF_THRESHOLD
- *   and an >= bn
- * Within this allowed uses we will never have an<rn when basecases
- * are needed.
- */
-void
 mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn, mp_ptr tp)
 {
   ASSERT (0 < bn);
@@ -219,12 +209,11 @@
 	      bp1 = so + n + 1;
 	      MPN_COPY (so + n + 1, b0, bnp);
 	      MPN_ZERO (so + n + 1 + bnp, n + 1 - bnp);
-	    }
-	    ASSERT (ALLOW_MISUSE || ((an >= rn) && (ap1 != a0)) );
-	    if (ALLOW_MISUSE && UNLIKELY (ap1 == a0)) {
-	      ap1 = so;
-	      MPN_COPY (so, a0, anp);
-	      MPN_ZERO (so + anp, n + 1 - anp);
+	      if (UNLIKELY (ap1 == a0)) { /* bn <= an, test can be nested. */
+		ap1 = so;
+		MPN_COPY (so, a0, anp);
+		MPN_ZERO (so + anp, n + 1 - anp);
+	      }
 	    }
 	    mpn_bc_mulmod_bnp1 (xp, ap1, bp1, n, xp);
 	  }


More information about the gmp-commit mailing list