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

mercurial at gmplib.org mercurial at gmplib.org
Sun Jan 3 09:25:49 UTC 2016


details:   /var/hg/gmp/rev/63b2ffc01c35
changeset: 17014:63b2ffc01c35
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:11:22 2016 +0100
description:
primesieve.c: Heal a speed regression on small values.

details:   /var/hg/gmp/rev/a5d60734546e
changeset: 17015:a5d60734546e
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:12:48 2016 +0100
description:
mpz/bin_uiui.c (mpz_bdiv_bin_uiui): 2 factors all at once.

details:   /var/hg/gmp/rev/556145276be9
changeset: 17016:556145276be9
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:13:41 2016 +0100
description:
mpn/generic/toom53_mul.c: Use _ip1 when available.

details:   /var/hg/gmp/rev/417bff790468
changeset: 17017:417bff790468
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:14:50 2016 +0100
description:
mpn/generic/invert.c: Use MPN_FILL macro.

details:   /var/hg/gmp/rev/e4f39019d159
changeset: 17018:e4f39019d159
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:15:55 2016 +0100
description:
mpn/generic/invertappr.c: Use MPN_FILL macro.

details:   /var/hg/gmp/rev/c2bab0290d6d
changeset: 17019:c2bab0290d6d
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:17:20 2016 +0100
description:
mini-gmp: Silence wanrings due to signed/unsigned types.

details:   /var/hg/gmp/rev/c3c2e01249cd
changeset: 17020:c3c2e01249cd
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:17:47 2016 +0100
description:
gen-fac.c: Use unsigned types for sizes.

details:   /var/hg/gmp/rev/ee31937aac1e
changeset: 17021:ee31937aac1e
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Jan 03 10:25:43 2016 +0100
description:
ChangeLog

diffstat:

 ChangeLog                  |  15 ++++++
 gen-fac.c                  |  16 +++---
 mini-gmp/mini-gmp.c        |  10 ++--
 mini-gmp/tests/t-cmp_d.c   |   6 +-
 mini-gmp/tests/t-cong.c    |   2 +-
 mini-gmp/tests/t-logops.c  |   2 +-
 mini-gmp/tests/t-reuse.c   |   2 +-
 mini-gmp/tests/testutils.c |   4 +-
 mpn/generic/invert.c       |   8 +--
 mpn/generic/invertappr.c   |  10 +---
 mpn/generic/toom53_mul.c   |  14 +++---
 mpz/bin_uiui.c             |  27 +++++------
 primesieve.c               |  99 ++++++++++++++++++++++-----------------------
 13 files changed, 108 insertions(+), 107 deletions(-)

diffs (truncated from 623 to 300 lines):

diff -r 60c77e71e1d3 -r ee31937aac1e ChangeLog
--- a/ChangeLog	Fri Jan 01 21:41:57 2016 +0100
+++ b/ChangeLog	Sun Jan 03 10:25:43 2016 +0100
@@ -3,6 +3,21 @@
 	* tests/cxx/clocale.c: Do not re-define localeconv for mingw.
 	* tests/misc/t-locale.c: Enable test for mingw (tx Alexander).
 
+	* primesieve.c: Heal a speed regression on small values.
+	* mpz/bin_uiui.c (mpz_bdiv_bin_uiui): 2 factors all at once.
+
+	* gen-fac.c: Use unsigned types for sizes.
+	* mini-gmp/mini-gmp.c: Silence wanrings due to (un)signed types.
+	* mini-gmp/tests/testutils.c: Likewise.
+	* mini-gmp/tests/t-logops.c: Likewise.
+	* mini-gmp/tests/t-cmp_d.c: Likewise.
+	* mini-gmp/tests/t-reuse.c: Likewise.
+	* mini-gmp/tests/t-cong.c: Likewise.
+
+	* mpn/generic/invert.c: Use MPN_FILL macro.
+	* mpn/generic/invertappr.c: Likewise.
+	* mpn/generic/toom53_mul.c: Use _ip1 when available.
+
 2015-12-28 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* mpq/set_str.c: Use __GMP_FREE_FUNC_TYPE.
diff -r 60c77e71e1d3 -r ee31937aac1e gen-fac.c
--- a/gen-fac.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/gen-fac.c	Sun Jan 03 10:25:43 2016 +0100
@@ -1,6 +1,6 @@
 /* Generate data for combinatorics: fac_ui, bin_uiui, ...
 
-Copyright 2002, 2011-2015 Free Software Foundation, Inc.
+Copyright 2002, 2011-2016 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -43,19 +43,19 @@
 
 /* returns 0 on success		*/
 int
-gen_consts (int numb, int nail, int limb)
+gen_consts (unsigned numb, unsigned limb)
 {
   mpz_t x, mask, y, last;
   unsigned long a, b;
   unsigned long ofl, ofe;
 
   printf ("/* This file is automatically generated by gen-fac.c */\n\n");
-  printf ("#if GMP_NUMB_BITS != %d\n", numb);
-  printf ("Error , error this data is for %d GMP_NUMB_BITS only\n", numb);
+  printf ("#if GMP_NUMB_BITS != %u\n", numb);
+  printf ("Error , error this data is for %u GMP_NUMB_BITS only\n", numb);
   printf ("#endif\n");
 #if 0
-  printf ("#if GMP_LIMB_BITS != %d\n", limb);
-  printf ("Error , error this data is for %d GMP_LIMB_BITS only\n", limb);
+  printf ("#if GMP_LIMB_BITS != %u\n", limb);
+  printf ("Error , error this data is for %u GMP_LIMB_BITS only\n", limb);
   printf ("#endif\n");
 #endif
 
@@ -101,7 +101,7 @@
   ofl = b - 1;
   printf
     ("#define ODD_FACTORIAL_TABLE_LIMIT (%lu)\n", ofl);
-  mpz_init2 (mask, numb + 1);
+  mpz_init (mask);
   mpz_setbit (mask, numb);
   mpz_sub_ui (mask, mask, 1);
   printf
@@ -280,6 +280,6 @@
 	       nail_bits);
       exit (1);
     }
-  gen_consts (numb_bits, nail_bits, limb_bits);
+  gen_consts (numb_bits, limb_bits);
   return 0;
 }
diff -r 60c77e71e1d3 -r ee31937aac1e mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mini-gmp/mini-gmp.c	Sun Jan 03 10:25:43 2016 +0100
@@ -1181,7 +1181,7 @@
   unsigned char mask;
   size_t sn, j;
   mp_size_t i;
-  int shift;
+  unsigned shift;
 
   sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1])
 	+ bits - 1) / bits;
@@ -3642,7 +3642,7 @@
   /* If the smaller input is positive, higher limbs don't matter. */
   rn = vx ? un : vn;
 
-  rp = MPZ_REALLOC (r, rn + rc);
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
 
   up = u->_mp_d;
   vp = v->_mp_d;
@@ -3715,7 +3715,7 @@
      don't matter. */
   rn = vx ? vn : un;
 
-  rp = MPZ_REALLOC (r, rn + rc);
+  rp = MPZ_REALLOC (r, rn + (mp_size_t) rc);
 
   up = u->_mp_d;
   vp = v->_mp_d;
@@ -3784,7 +3784,7 @@
   vx = -vc;
   rx = -rc;
 
-  rp = MPZ_REALLOC (r, un + rc);
+  rp = MPZ_REALLOC (r, un + (mp_size_t) rc);
 
   up = u->_mp_d;
   vp = v->_mp_d;
@@ -4159,7 +4159,7 @@
       else
 	digit = base; /* fail */
 
-      if (digit >= base)
+      if (digit >= (unsigned) base)
 	{
 	  gmp_free (dp);
 	  r->_mp_size = 0;
diff -r 60c77e71e1d3 -r ee31937aac1e mini-gmp/tests/t-cmp_d.c
--- a/mini-gmp/tests/t-cmp_d.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mini-gmp/tests/t-cmp_d.c	Sun Jan 03 10:25:43 2016 +0100
@@ -36,7 +36,7 @@
   got = mpz_cmp_d (x, y);
   if (SGN(got) != cmp)
     {
-      int i;
+      unsigned i;
       printf    ("mpz_cmp_d wrong (from %s)\n", name);
       printf    ("  got  %d\n", got);
       printf    ("  want %d\n", cmp);
@@ -97,8 +97,8 @@
     { "-2", -1.5,  -1,  1 },
   };
 
-  mpz_t  x;
-  int    i;
+  mpz_t    x;
+  unsigned i;
 
   mpz_init (x);
 
diff -r 60c77e71e1d3 -r ee31937aac1e mini-gmp/tests/t-cong.c
--- a/mini-gmp/tests/t-cong.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mini-gmp/tests/t-cong.c	Sun Jan 03 10:25:43 2016 +0100
@@ -106,7 +106,7 @@
   };
 
   mpz_t   a, c, d;
-  int     i;
+  unsigned   i;
 
   mpz_init (a);
   mpz_init (c);
diff -r 60c77e71e1d3 -r ee31937aac1e mini-gmp/tests/t-logops.c
--- a/mini-gmp/tests/t-logops.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mini-gmp/tests/t-logops.c	Sun Jan 03 10:25:43 2016 +0100
@@ -29,7 +29,7 @@
 void
 testlogops (int count)
 {
-  unsigned i;
+  int i;
   mpz_t a, b, res, ref;
   mp_bitcnt_t c;
 
diff -r 60c77e71e1d3 -r ee31937aac1e mini-gmp/tests/t-reuse.c
--- a/mini-gmp/tests/t-reuse.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mini-gmp/tests/t-reuse.c	Sun Jan 03 10:25:43 2016 +0100
@@ -145,7 +145,7 @@
 void
 testmain (int argc, char **argv)
 {
-  int i;
+  unsigned i;
   int pass, reps = COUNT;
   mpz_t in1, in2, in3;
   unsigned long int in2i;
diff -r 60c77e71e1d3 -r ee31937aac1e mini-gmp/tests/testutils.c
--- a/mini-gmp/tests/testutils.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mini-gmp/tests/testutils.c	Sun Jan 03 10:25:43 2016 +0100
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2013, 2014, Free Software Foundation, Inc.
+Copyright 2013-2015, Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -35,7 +35,7 @@
    which shouldn't have stricter alignment requirements than
    size_t. */
 
-static char block_end[8] =
+static unsigned char block_end[8] =
   { 0x7c, 0x37, 0xd6, 0x12, 0xa8, 0x6c, 0x01, 0xd1 };
 
 static void *
diff -r 60c77e71e1d3 -r ee31937aac1e mpn/generic/invert.c
--- a/mpn/generic/invert.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mpn/generic/invert.c	Sun Jan 03 10:25:43 2016 +0100
@@ -6,7 +6,7 @@
    SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
 
-Copyright (C) 2007, 2009, 2010, 2012, 2014-2015 Free Software Foundation, Inc.
+Copyright (C) 2007, 2009, 2010, 2012, 2014-2016 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -52,15 +52,11 @@
   else if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD))
     {
 	/* Maximum scratch needed by this branch: 2*n */
-	mp_size_t i;
 	mp_ptr xp;
 
 	xp = scratch;				/* 2 * n limbs */
 	/* n > 1 here */
-	i = n;
-	do
-	  xp[--i] = GMP_NUMB_MAX;
-	while (i);
+	MPN_FILL (xp, n, GMP_NUMB_MAX);
 	mpn_com (xp + n, dp, n);
 	if (n == 2) {
 	  mpn_divrem_2 (ip, 0, xp, 4, dp);
diff -r 60c77e71e1d3 -r ee31937aac1e mpn/generic/invertappr.c
--- a/mpn/generic/invertappr.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mpn/generic/invertappr.c	Sun Jan 03 10:25:43 2016 +0100
@@ -12,7 +12,8 @@
    SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
 
-Copyright (C) 2007, 2009, 2010, 2012, 2015 Free Software Foundation, Inc.
+Copyright (C) 2007, 2009, 2010, 2012, 2015, 2016 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -97,13 +98,8 @@
   if (n == 1)
     invert_limb (*ip, *dp);
   else {
-    mp_size_t i;
-
     /* n > 1 here */
-    i = n;
-    do
-      xp[--i] = GMP_NUMB_MAX;
-    while (i);
+    MPN_FILL (xp, n, GMP_NUMB_MAX);
     mpn_com (xp + n, dp, n);
 
     /* Now xp contains B^2n - {dp,n}*B^n - 1 */
diff -r 60c77e71e1d3 -r ee31937aac1e mpn/generic/toom53_mul.c
--- a/mpn/generic/toom53_mul.c	Fri Jan 01 21:41:57 2016 +0100
+++ b/mpn/generic/toom53_mul.c	Sun Jan 03 10:25:43 2016 +0100
@@ -10,7 +10,7 @@
    SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
    GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
 
-Copyright 2006-2008, 2012, 2014 Free Software Foundation, Inc.
+Copyright 2006-2008, 2012, 2014, 2015 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -264,8 +264,8 @@
     }
   else if (asm1[n] == 2)
     {
-#if HAVE_NATIVE_mpn_addlsh1_n
-      cy = 2 * bsm1[n] + mpn_addlsh1_n (vm1 + n, vm1 + n, bsm1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+      cy = 2 * bsm1[n] + mpn_addlsh1_n_ip1 (vm1 + n, bsm1, n);
 #else
       cy = 2 * bsm1[n] + mpn_addmul_1 (vm1 + n, bsm1, n, CNST_LIMB(2));
 #endif
@@ -289,8 +289,8 @@
     }
   else if (as1[n] == 2)
     {
-#if HAVE_NATIVE_mpn_addlsh1_n
-      cy = 2 * bs1[n] + mpn_addlsh1_n (v1 + n, v1 + n, bs1, n);
+#if HAVE_NATIVE_mpn_addlsh1_n_ip1
+      cy = 2 * bs1[n] + mpn_addlsh1_n_ip1 (v1 + n, bs1, n);
 #else
       cy = 2 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(2));
 #endif
@@ -307,8 +307,8 @@
     }
   else if (bs1[n] == 2)
     {


More information about the gmp-commit mailing list