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

mercurial at gmplib.org mercurial at gmplib.org
Fri Nov 16 20:17:10 CET 2012


details:   /var/hg/gmp/rev/5cb0cd0947ac
changeset: 15117:5cb0cd0947ac
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Nov 16 20:16:10 2012 +0100
description:
Adjust sbpi1 scratch argument in new div_sec code.

details:   /var/hg/gmp/rev/1dcd1801bfc3
changeset: 15118:1dcd1801bfc3
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Nov 16 20:16:46 2012 +0100
description:
(redcify): Use mpn_sb_div_r_sec.

details:   /var/hg/gmp/rev/68755226fce7
changeset: 15119:68755226fce7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Nov 16 20:16:54 2012 +0100
description:
*** empty log message ***

diffstat:

 ChangeLog                |   2 ++
 mpn/generic/powm_sec.c   |  16 ++++++++++++++++
 mpn/generic/sb_div_sec.c |   6 ++++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diffs (62 lines):

diff -r 63c0ee6b80e1 -r 68755226fce7 ChangeLog
--- a/ChangeLog	Fri Nov 16 18:00:09 2012 +0100
+++ b/ChangeLog	Fri Nov 16 20:16:54 2012 +0100
@@ -1,5 +1,7 @@
 2012-11-16  Torbjorn Granlund  <tege at gmplib.org>
 
+	* mpn/generic/powm_sec.c (redcify): Use mpn_sb_div_r_sec.
+
 	* mpn/generic/sb_div_sec.c: New file.
 	* mpn/generic/sbpi1_div_sec.c: New file.
 	* configure.in (gmp_mpn_functions): Add new files.
diff -r 63c0ee6b80e1 -r 68755226fce7 mpn/generic/powm_sec.c
--- a/mpn/generic/powm_sec.c	Fri Nov 16 18:00:09 2012 +0100
+++ b/mpn/generic/powm_sec.c	Fri Nov 16 20:16:54 2012 +0100
@@ -232,13 +232,29 @@
 static void
 redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n, mp_ptr tp)
 {
+#if 0
   mp_ptr qp;
 
   qp = tp + un + n;		/* un + n - n + 1 = un + 1 limbs */
 
   MPN_ZERO (tp, n);
   MPN_COPY (tp + n, up, un);
+
   mpn_tdiv_qr (qp, rp, 0L, tp, un + n, mp, n);
+#else
+  /* FIXME: Use passed scratch space instead of allocating our own!  */
+  mp_ptr scratch;
+  TMP_DECL;
+  TMP_MARK;
+
+  MPN_ZERO (tp, n);
+  MPN_COPY (tp + n, up, un);
+
+  scratch = TMP_ALLOC_LIMBS ((un + n) + 2 * n + 2);
+  mpn_sb_div_r_sec (tp, un + n, mp, n, scratch);
+  MPN_COPY (rp, tp, n);
+  TMP_FREE;
+#endif
 }
 
 /* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0]
diff -r 63c0ee6b80e1 -r 68755226fce7 mpn/generic/sb_div_sec.c
--- a/mpn/generic/sb_div_sec.c	Fri Nov 16 18:00:09 2012 +0100
+++ b/mpn/generic/sb_div_sec.c	Fri Nov 16 20:16:54 2012 +0100
@@ -94,10 +94,12 @@
       inv32 = dinv.inv32;
     }
 
+  /* We add nn + dn to tp here, not nn + 1 + dn, as expected.  This is since nn
+     here will have been incremented.  */
 #if OPERATION_sb_div_qr_sec
-  qh = mpn_sbpi1_div_qr_sec (qp, np2, nn, dp2, dn, inv32, tp + nn + dn + 1);
+  qh = mpn_sbpi1_div_qr_sec (qp, np2, nn, dp2, dn, inv32, tp + nn + dn);
 #else
-  mpn_sbpi1_div_r_sec (np2, nn, dp2, dn, inv32, tp + nn + dn + 1);
+  mpn_sbpi1_div_r_sec (np2, nn, dp2, dn, inv32, tp + nn + dn);
 #endif
 
   if (cnt == 0)


More information about the gmp-commit mailing list