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

mercurial at gmplib.org mercurial at gmplib.org
Mon Mar 26 21:24:21 UTC 2018


details:   /var/hg/gmp/rev/c5c1f6d537f4
changeset: 17592:c5c1f6d537f4
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Mar 26 23:17:01 2018 +0200
description:
mpn/generic/sec_powm.c (mpn_local_sqr): Use SQR_BASECASE_THRESHOLD

details:   /var/hg/gmp/rev/6962c4568e4b
changeset: 17593:6962c4568e4b
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Mar 26 23:24:03 2018 +0200
description:
mpn/generic/sec_powm.c (mpn_local_sqr): Remove unused scratch pointer

diffstat:

 mpn/generic/sec_powm.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (62 lines):

diff -r 2a3b146aee90 -r 6962c4568e4b mpn/generic/sec_powm.c
--- a/mpn/generic/sec_powm.c	Sun Mar 25 00:47:27 2018 +0100
+++ b/mpn/generic/sec_powm.c	Mon Mar 26 23:24:03 2018 +0200
@@ -114,17 +114,17 @@
 #ifndef SQR_BASECASE_LIM
 /* If SQR_BASECASE_LIM is now not defined, use mpn_sqr_basecase for any operand
    size.  */
-#define mpn_local_sqr(rp,up,n,tp) mpn_sqr_basecase(rp,up,n)
-#else
-/* Else use mpn_sqr_basecase for its allowed sizes, else mpn_mul_basecase.  */
-#define mpn_local_sqr(rp,up,n,tp) \
+#define SQR_BASECASE_LIM  MP_SIZE_T_MAX
+#endif
+
+#define mpn_local_sqr(rp,up,n)						\
   do {									\
-    if (BELOW_THRESHOLD (n, SQR_BASECASE_LIM))				\
+    if (ABOVE_THRESHOLD (n, SQR_BASECASE_THRESHOLD)			\
+	&& BELOW_THRESHOLD (n, SQR_BASECASE_LIM))			\
       mpn_sqr_basecase (rp, up, n);					\
     else								\
       mpn_mul_basecase(rp, up, n, up, n);				\
   } while (0)
-#endif
 
 #define getbit(p,bi) \
   ((p[(bi - 1) / GMP_NUMB_BITS] >> (bi - 1) % GMP_NUMB_BITS) & 1)
@@ -260,7 +260,7 @@
     {
       for (i = (1 << windowsize) - 2; i > 0; i -= 2)
 	{
-	  mpn_local_sqr (tp, ps, n, tp + 2 * n);
+	  mpn_local_sqr (tp, ps, n);
 	  ps += n;
 	  this_pp += n;
 	  MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
@@ -274,7 +274,7 @@
     {
       for (i = (1 << windowsize) - 2; i > 0; i -= 2)
 	{
-	  mpn_local_sqr (tp, ps, n, tp + 2 * n);
+	  mpn_local_sqr (tp, ps, n);
 	  ps += n;
 	  this_pp += n;
 	  MPN_REDC_2_SEC (this_pp, tp, mp, n, mip);
@@ -310,7 +310,7 @@
 									\
       do								\
 	{								\
-	  mpn_local_sqr (tp, rp, n, tp + 2 * n);			\
+	  mpn_local_sqr (tp, rp, n);					\
 	  MPN_REDUCE (rp, tp, mp, n, mip);				\
 	  this_windowsize--;						\
 	}								\
@@ -353,6 +353,7 @@
   int windowsize;
   mp_size_t redcify_itch, itch;
 
+  /* FIXME: no more _local/_basecase difference. */
   /* The top scratch usage will either be when reducing B in the 2nd redcify
      call, or more typically n*2^windowsize + 3n or 4n, in the main loop.  (It
      is 3n or 4n depending on if we use mpn_local_sqr or a native


More information about the gmp-commit mailing list