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

mercurial at gmplib.org mercurial at gmplib.org
Mon Dec 30 20:01:55 UTC 2013


details:   /var/hg/gmp/rev/0f2193931390
changeset: 16128:0f2193931390
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 30 17:50:30 2013 +0100
description:
Whitespace cleanup.

details:   /var/hg/gmp/rev/ec1f6820e8fa
changeset: 16129:ec1f6820e8fa
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 30 17:51:19 2013 +0100
description:
Mention 5.1.2 bugs.

details:   /var/hg/gmp/rev/b3e69f9418cb
changeset: 16130:b3e69f9418cb
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 30 18:39:18 2013 +0100
description:
Comment update.

details:   /var/hg/gmp/rev/813b1e87ad10
changeset: 16131:813b1e87ad10
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 30 20:42:46 2013 +0100
description:
Insert 5.1.3 changes.

details:   /var/hg/gmp/rev/110c53d72234
changeset: 16132:110c53d72234
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Mon Dec 30 21:01:35 2013 +0100
description:
Don't use internal types in documentation.

diffstat:

 NEWS                      |  27 ++++++++++++++++++++++++++-
 doc/gmp.texi              |  14 +++++++-------
 mpn/generic/sec_minvert.c |  17 ++++++++---------
 mpn/ia64/README           |   2 +-
 tests/mpn/t-minvert.c     |   6 +++---
 5 files changed, 45 insertions(+), 21 deletions(-)

diffs (216 lines):

diff -r 3c3384c207fe -r 110c53d72234 NEWS
--- a/NEWS	Mon Dec 30 17:39:58 2013 +0100
+++ b/NEWS	Mon Dec 30 21:01:35 2013 +0100
@@ -7,6 +7,7 @@
 Changes between GMP version 5.1.* and 5.2.0
 
   BUGS FIXED
+  * Contains all fixes from release 5.1.3.
 
   SPEEDUPS
   * Plain division of large operands is faster and more monotonous in operand
@@ -23,7 +24,7 @@
 
   * Faster mixed arithmetic between mpq_class and double.
 
-  * With g++, optimize more operations when one argument is a simple constant.
+  * With g++, optimise more operations when one argument is a simple constant.
 
   FEATURES
   * Support for new Intel and AMD CPUs.
@@ -51,6 +52,30 @@
     The reason is that the FreeBSD m4 command is not correctly implemented.
 
 
+Changes between GMP version 5.1.2 and 5.1.3
+
+  BUGS FIXED
+  * The internal functions mpn_sbpi1_div_qr_sec mpn_sbpi1_div_r_sec could
+    compute garbage with a low probability.  They are now rewritten, and the
+    test code has been improved.
+
+  * A bug in the ia64 implementation of mpn_divrem_2, clobbering some
+    callee-save registers, has been fixed. This is an internal
+    function, with the bug manifesting itself as miscomputation in,
+    e.g., mpn_sqrtrem.
+
+  * The documentation now correctly says 'const' for input arguments.
+
+  SPEEDUPS
+  * None.
+
+  FEATURES
+  * None.
+
+  MISC
+  * None.
+
+
 Changes between GMP version 5.1.1 and 5.1.2
 
   BUGS FIXED
diff -r 3c3384c207fe -r 110c53d72234 doc/gmp.texi
--- a/doc/gmp.texi	Mon Dec 30 17:39:58 2013 +0100
+++ b/doc/gmp.texi	Mon Dec 30 21:01:35 2013 +0100
@@ -5661,7 +5661,7 @@
 @cindex Low-level functions for cryptography
 @cindex Cryptography functions, low-level
 
-The functions prefixed with @code{mpn_sec_} and @code{mpn_cnd} are designed to
+The functions prefixed with @code{mpn_sec_} and @code{mpn_cnd_} are designed to
 perform the exact same low-level operations and have the same cache access
 patterns for any two same-size arguments, assuming that function arguments are
 placed at the same position and that the machine state is identical upon
@@ -5705,7 +5705,7 @@
 actual limb values.
 @end deftypefun
 
- at deftypefun void mpn_sec_mul (mp_ptr @var{rp}, mp_srcptr @var{ap}, mp_size_t @var{an}, mp_srcptr @var{bp}, mp_size_t @var{bn}, mp_ptr @var{tp})
+ at deftypefun void mpn_sec_mul (mp_limb_t *@var{rp}, const mp_limb_t *@var{ap}, mp_size_t @var{an}, const mp_limb_t *@var{bp}, mp_size_t @var{bn}, mp_limb_t *@var{tp})
 @deftypefunx mp_size_t mpn_sec_mul_itch (mp_size_t @var{an}, mp_size_t @var{bn})
 Set @var{R} to @math{A @times B}, where @var{A} = @{@var{ap}, at var{an}@},
 @var{B} = @{@var{bp}, at var{bn}@}, and @var{R} =
@@ -5722,7 +5722,7 @@
 @end deftypefun
 
 
- at deftypefun void mpn_sec_sqr (mp_ptr @var{rp}, mp_srcptr @var{ap}, mp_size_t @var{an}, mp_ptr @var{tp})
+ at deftypefun void mpn_sec_sqr (mp_limb_t *@var{rp}, const mp_limb_t *@var{ap}, mp_size_t @var{an}, mp_limb_t *@var{tp})
 @deftypefunx mp_size_t mpn_sec_sqr_itch (mp_size_t @var{an})
 Set @var{R} to @math{A^2}, where @var{A} = @{@var{ap}, at var{an}@}, and @var{R} =
 @{@var{rp}, at math{2 at var{an}}@}.
@@ -5737,7 +5737,7 @@
 @end deftypefun
 
 
- at deftypefun void mpn_sec_powm (mp_ptr @var{rp}, mp_srcptr @var{bp}, mp_size_t @var{bn}, mp_srcptr @var{ep}, mp_size_t @var{en},  mp_srcptr @var{mp}, mp_size_t @var{n}, mp_ptr @var{tp})
+ at deftypefun void mpn_sec_powm (mp_limb_t *@var{rp}, const mp_limb_t *@var{bp}, mp_size_t @var{bn}, const mp_limb_t *@var{ep}, mp_size_t @var{en},  const mp_limb_t *@var{mp}, mp_size_t @var{n}, mp_limb_t *@var{tp})
 @deftypefunx mp_size_t mpn_sec_powm_itch (mp_size_t @var{bn}, mp_size_t @var{en}, size_t @var{n})
 Set @var{R} to @m{B^E \bmod @var{M}, (@var{B} raised to @var{E}) modulo
 @var{M}}, where @var{R} = @{@var{rp}, at var{n}@}, @var{M} = @{@var{mp}, at var{n}@},
@@ -5755,14 +5755,14 @@
 sizes.
 @end deftypefun
 
- at deftypefun void mpn_sec_tabselect (mp_ptr @var{rp}, mp_srcptr @var{tab}, mp_size_t @var{n}, mp_size_t @var{nents}, mp_size_t @var{which})
+ at deftypefun void mpn_sec_tabselect (mp_limb_t *@var{rp}, const mp_limb_t *@var{tab}, mp_size_t @var{n}, mp_size_t @var{nents}, mp_size_t @var{which})
 Select entry @var{which} from table @var{tab}, which has @var{nents} entries, each @var{n}
 limbs.  Store the selected entry at @var{rp}.
 
 This function reads the entire table to avoid side-channel information leaks.
 @end deftypefun
 
- at deftypefun void mpn_sec_div_qr (mp_ptr @var{qp}, mp_ptr @var{np}, mp_size_t @var{nn}, mp_srcptr @var{dp}, mp_size_t @var{dn}, mp_ptr @var{tp})
+ at deftypefun void mpn_sec_div_qr (mp_limb_t *@var{qp}, mp_limb_t *@var{np}, mp_size_t @var{nn}, const mp_limb_t *@var{dp}, mp_size_t @var{dn}, mp_limb_t *@var{tp})
 @deftypefunx mp_size_t mpn_sec_div_qr_itch (mp_size_t @var{nn}, mp_size_t @var{dn})
 @strong{This function's interface is preliminary.}
 
@@ -5783,7 +5783,7 @@
 @var{dn})} limbs to be passed in the @var{tp} parameter.
 @end deftypefun
 
- at deftypefun void mpn_sec_div_r (mp_ptr @var{np}, mp_size_t @var{nn}, mp_srcptr @var{dp}, mp_size_t @var{dn}, mp_ptr @var{tp})
+ at deftypefun void mpn_sec_div_r (mp_limb_t *@var{np}, mp_size_t @var{nn}, const mp_limb_t *@var{dp}, mp_size_t @var{dn}, mp_limb_t *@var{tp})
 @deftypefunx mp_size_t mpn_sec_div_r_itch (mp_size_t @var{nn}, mp_size_t @var{dn})
 @strong{This function's interface is preliminary.}
 
diff -r 3c3384c207fe -r 110c53d72234 mpn/generic/sec_minvert.c
--- a/mpn/generic/sec_minvert.c	Mon Dec 30 17:39:58 2013 +0100
+++ b/mpn/generic/sec_minvert.c	Mon Dec 30 21:01:35 2013 +0100
@@ -75,7 +75,7 @@
   ASSERT (n > 0);
 
   d = ap[0] ^ b;
-  
+
   while (--n > 0)
     d |= ap[n];
 
@@ -107,7 +107,7 @@
 #define bp (scratch + n)
 #define up (scratch + 2*n)
 #define m1hp (scratch + 3*n)
-  
+
   /* Maintain
 
        a = u * orig_a (mod m)
@@ -127,11 +127,11 @@
 
   ASSERT_CARRY (mpn_rshift (m1hp, mp, n, 1));
   ASSERT_NOCARRY (mpn_sec_add_1 (m1hp, m1hp, n, 1, scratch));
-  
+
   while (bit_size-- > 0)
     {
       mp_limb_t odd, swap, cy;
-      
+
       /* Always maintain b odd. The logic of the iteration is as
 	 follows. For a, b:
 
@@ -142,7 +142,7 @@
 	       b += a, assigns old a
 	       a = B^n-a
 	     }
-	   
+
 	   a /= 2
 
 	 For u, v:
@@ -161,10 +161,9 @@
 
 	   (bitsize of a) + (bitsize of b)
 
-	 is reduced by at least one bit per iteration, hence after
-         (bit_size of orig_a) + (bit_size of m) - 1 iterations we
-         surely have a = 0. Then b = gcd(orig_a, m) and if b = 1 then
-         also v = orig_a^{-1} (mod m)
+	 is reduced by at least one bit per iteration, hence after (bit_size of
+	 orig_a) + (bit_size of m) - 1 iterations we surely have a = 0. Then b
+	 = gcd(orig_a, m) and if b = 1 then also v = orig_a^{-1} (mod m).
       */
 
       ASSERT (bp[0] & 1);
diff -r 3c3384c207fe -r 110c53d72234 mpn/ia64/README
--- a/mpn/ia64/README	Mon Dec 30 17:39:58 2013 +0100
+++ b/mpn/ia64/README	Mon Dec 30 21:01:35 2013 +0100
@@ -155,7 +155,7 @@
 ================================================================
 mpn_addmul_N
 
-For best speed, we need to give up using mpn_addmul_1 as the main multiply
+For best speed, we need to give up using mpn_addmul_2 as the main multiply
 building block, and instead take multiple v limbs per loop.  For the Itanium
 1, we need to take about 8 limbs at a time for full speed.  For the Itanium
 2, something like mpn_addmul_4 should be enough.
diff -r 3c3384c207fe -r 110c53d72234 tests/mpn/t-minvert.c
--- a/tests/mpn/t-minvert.c	Mon Dec 30 17:39:58 2013 +0100
+++ b/tests/mpn/t-minvert.c	Mon Dec 30 21:01:35 2013 +0100
@@ -45,7 +45,7 @@
 	  && mpn_cmp (ap, mpz_limbs_read (b), bn) == 0
 	  && mpn_zero_p (ap + bn, an - bn));
 }
- 
+
 int
 main (int argc, char **argv)
 {
@@ -93,7 +93,7 @@
       mp_size_t n;
 
       bits = urandom () % (GMP_NUMB_BITS * MAX_SIZE) + 1;
-      
+
       if (test & 1)
 	mpz_rrandomb (m, rands, bits);
       else
@@ -158,7 +158,7 @@
 	  abort ();
 	}
     }
-  
+
   TMP_FREE;
 
   mpz_clear (m);


More information about the gmp-commit mailing list