[Gmp-commit] /var/hg/gmp-5.1: Backport 2 unsigned patches.

mercurial at gmplib.org mercurial at gmplib.org
Fri Sep 20 20:40:20 CEST 2013


details:   /var/hg/gmp-5.1/rev/a06cfe94884b
changeset: 15435:a06cfe94884b
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Fri Sep 20 20:40:15 2013 +0200
description:
Backport 2 unsigned patches.

diffstat:

 ChangeLog           |  5 +++++
 mpn/generic/get_d.c |  2 +-
 mpz/kronzs.c        |  2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 266c28da4680 -r a06cfe94884b ChangeLog
--- a/ChangeLog	Wed Jul 17 17:42:56 2013 +0200
+++ b/ChangeLog	Fri Sep 20 20:40:15 2013 +0200
@@ -12,6 +12,11 @@
 	* mpn/powerpc64/p6/rshift.asm: Likewise.
 	* mpn/powerpc64/p6/lshiftc.asm: Likewise.
 
+2013-06-09  Marc Glisse  <marc.glisse at inria.fr>
+
+	* mpn/generic/get_d.c (mpn_get_d): Avoid signed overflow.
+	* mpz/kronzs.c (mpz_kronecker_si): Use ABS_CAST.
+
 2013-05-22  Torbjorn Granlund  <tege at gmplib.org>
 
 	* doc/gmp.texi (Reporting Bugs): Ask for configure's output.
diff -r 266c28da4680 -r a06cfe94884b mpn/generic/get_d.c
--- a/mpn/generic/get_d.c	Wed Jul 17 17:42:56 2013 +0200
+++ b/mpn/generic/get_d.c	Fri Sep 20 20:40:15 2013 +0200
@@ -135,7 +135,7 @@
      overflow.  After this exp can of course be reduced to anywhere within
      the {up,size} region without underflow.  */
   if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size)
-		> (unsigned long) (LONG_MAX - exp)))
+		> ((unsigned long) LONG_MAX - exp)))
     {
 #if _GMP_IEEE_FLOATS
       goto ieee_infinity;
diff -r 266c28da4680 -r a06cfe94884b mpz/kronzs.c
--- a/mpz/kronzs.c	Wed Jul 17 17:42:56 2013 +0200
+++ b/mpz/kronzs.c	Fri Sep 20 20:40:15 2013 +0200
@@ -50,7 +50,7 @@
 #endif
 
   result_bit1 = JACOBI_BSGN_SS_BIT1 (a_size, b);
-  b_limb = (unsigned long) ABS (b);
+  b_limb = ABS_CAST (unsigned long, b);
   a_ptr = PTR(a);
 
   if ((b_limb & 1) == 0)


More information about the gmp-commit mailing list