[Gmp-commit] /var/hg/gmp-5.0: powm_sec.c: Handle fat binaries better

mercurial at gmplib.org mercurial at gmplib.org
Fri Jan 20 11:09:12 CET 2012


details:   /var/hg/gmp-5.0/rev/b4587b7f06c2
changeset: 13507:b4587b7f06c2
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Fri Jan 20 11:09:04 2012 +0100
description:
powm_sec.c: Handle fat binaries better

diffstat:

 ChangeLog              |   4 ++++
 mpn/generic/powm_sec.c |  10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r d169a6249f63 -r b4587b7f06c2 ChangeLog
--- a/ChangeLog	Fri Jan 20 09:23:02 2012 +0100
+++ b/ChangeLog	Fri Jan 20 11:09:04 2012 +0100
@@ -25,6 +25,10 @@
 
 	* mpz/hamdist.c: Fix typo in a return statement.
 
+2011-12-08  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/generic/powm_sec.c: Handle fat binaries better.
+
 2011-12-07  Torbjorn Granlund  <tege at gmplib.org>
 
 	* configure.in: Fix typo making HAVE_NATIVE_mpn_X fail for fat
diff -r d169a6249f63 -r b4587b7f06c2 mpn/generic/powm_sec.c
--- a/mpn/generic/powm_sec.c	Fri Jan 20 09:23:02 2012 +0100
+++ b/mpn/generic/powm_sec.c	Fri Jan 20 11:09:04 2012 +0100
@@ -95,6 +95,14 @@
 #endif
 #endif
 
+#ifdef WANT_FAT_BINARY
+/* For fat builds, we would need to quantify over all mpn_sqr_basecase limit
+   that may appear in __gmpn_cpuvec.  This asks for some configure.in hacking.
+   For now, define a safe limit which all mpn_sqr_basecase will handle.
+   FIXME!  */
+#define SQR_BASECASE_MAX 32
+#endif
+
 #ifndef SQR_BASECASE_MAX
 /* If SQR_BASECASE_MAX is now not defined, use mpn_sqr_basecase for any operand
    size.  */
@@ -110,7 +118,7 @@
   ASSERT (n >= 1);
   ASSERT (! MPN_OVERLAP_P (rp, 2*n, up, n));
 
-  if (n < SQR_BASECASE_MAX)
+  if (n <= SQR_BASECASE_MAX)
     {
       mpn_sqr_basecase (rp, up, n);
       return;


More information about the gmp-commit mailing list