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

mercurial at gmplib.org mercurial at gmplib.org
Sat Jan 26 10:52:22 CET 2013


details:   /var/hg/gmp/rev/2f7b1898b7b1
changeset: 15359:2f7b1898b7b1
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jan 26 10:31:44 2013 +0100
description:
mpz/remove.c: init+set=init_set, cast before shifting

details:   /var/hg/gmp/rev/a3fc1d82c3a1
changeset: 15360:a3fc1d82c3a1
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jan 26 10:32:12 2013 +0100
description:
ChangeLog

details:   /var/hg/gmp/rev/e68cac0f5fa1
changeset: 15361:e68cac0f5fa1
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jan 26 10:50:29 2013 +0100
description:
mpz/cmp_si.c: Use ABS_CAST.

details:   /var/hg/gmp/rev/026f35713f16
changeset: 15362:026f35713f16
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sat Jan 26 10:50:43 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog    |  6 ++++++
 mpz/cmp_si.c |  8 ++++----
 mpz/remove.c |  7 +++----
 3 files changed, 13 insertions(+), 8 deletions(-)

diffs (77 lines):

diff -r d953d77ce081 -r 026f35713f16 ChangeLog
--- a/ChangeLog	Sat Jan 26 10:01:07 2013 +0100
+++ b/ChangeLog	Sat Jan 26 10:50:43 2013 +0100
@@ -1,3 +1,9 @@
+2013-01-26 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpz/remove.c: init+set=init_set, cast before shifting.
+
+	* mpz/cmp_si.c: Use ABS_CAST.
+
 2013-01-26  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tests/mpn/t-mod_1.c: Test also mpn_mod_1s_3p.
diff -r d953d77ce081 -r 026f35713f16 mpz/cmp_si.c
--- a/mpz/cmp_si.c	Sat Jan 26 10:01:07 2013 +0100
+++ b/mpz/cmp_si.c	Sat Jan 26 10:50:43 2013 +0100
@@ -1,8 +1,8 @@
 /* mpz_cmp_si(u,v) -- Compare an integer U with a single-word int V.
    Return positive, zero, or negative based on if U > V, U == V, or U < V.
 
-Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2012, 2013 Free
+Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -28,7 +28,7 @@
   mp_size_t usize = SIZ (u);
   mp_size_t vsize;
   mp_limb_t u_digit;
-  unsigned long int absv_digit = (unsigned long int) v_digit;
+  unsigned long int absv_digit;
 
 #if GMP_NAIL_BITS != 0
   /* FIXME.  This isn't very pretty.  */
@@ -46,8 +46,8 @@
   else if (v_digit < 0)
     {
       vsize = -1;
-      absv_digit = -absv_digit;
     }
+  absv_digit = ABS_CAST (unsigned long int, v_digit);
 
   if (usize != vsize)
     return usize - vsize;
diff -r d953d77ce081 -r 026f35713f16 mpz/remove.c
--- a/mpz/remove.c	Sat Jan 26 10:01:07 2013 +0100
+++ b/mpz/remove.c	Sat Jan 26 10:50:43 2013 +0100
@@ -78,8 +78,7 @@
       mpz_init (x);
 
       pwr = 0;
-      mpz_init (fpow[0]);
-      mpz_set (fpow[0], f);
+      mpz_init_set (fpow[0], f);
       mpz_set (dest, src);
 
       /* Divide by f, f^2 ... f^(2^k) until we get a remainder for f^(2^k).  */
@@ -93,7 +92,7 @@
 	  mpz_set (dest, x);
 	}
 
-      pwr = (1L << p) - 1;
+      pwr = ((mp_bitcnt_t)1 << p) - 1;
 
       mpz_clear (fpow[p]);
 
@@ -104,7 +103,7 @@
 	  mpz_tdiv_qr (x, rem, dest, fpow[p]);
 	  if (SIZ (rem) == 0)
 	    {
-	      pwr += 1L << p;
+	      pwr += (mp_bitcnt_t)1 << p;
 	      mpz_set (dest, x);
 	    }
 	  mpz_clear (fpow[p]);


More information about the gmp-commit mailing list