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

mercurial at gmplib.org mercurial at gmplib.org
Mon Nov 16 20:42:39 UTC 2020


details:   /var/hg/gmp/rev/721c7cbfca7e
changeset: 18163:721c7cbfca7e
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Nov 16 21:34:52 2020 +0100
description:
(adapted from GMP-6.2) Avoid C99 constructs, fix some undefined behavour, fix gcd tests to exit correctly

details:   /var/hg/gmp/rev/30aecaac3d0b
changeset: 18164:30aecaac3d0b
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sat May 16 16:18:55 2020 +0200
description:
Avoid C99 constructs.

details:   /var/hg/gmp/rev/8434d844930b
changeset: 18165:8434d844930b
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Mon May 18 23:42:39 2020 +0200
description:
(DO_mpn_addlsh_n): Define only when needed.

details:   /var/hg/gmp/rev/6f730ddb350f
changeset: 18166:6f730ddb350f
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Tue May 19 23:05:54 2020 +0200
description:
(enum hex_random_op): Remove final ",".

details:   /var/hg/gmp/rev/f25f9cf8b364
changeset: 18167:f25f9cf8b364
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:35:29 2020 +0200
description:
Provide default M_PI definition.

details:   /var/hg/gmp/rev/87ffac435491
changeset: 18168:87ffac435491
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:39:37 2020 +0200
description:
(testmain): Cast printf args to right type.

details:   /var/hg/gmp/rev/e9c72aa83832
changeset: 18169:e9c72aa83832
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:41:11 2020 +0200
description:
Add clarifying parens.

details:   /var/hg/gmp/rev/01bf7b0fe1ba
changeset: 18170:01bf7b0fe1ba
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:43:02 2020 +0200
description:
Don't use C++ comments.

details:   /var/hg/gmp/rev/95b1ea4d2bc4
changeset: 18171:95b1ea4d2bc4
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:46:47 2020 +0200
description:
Avoid getpagesize and use POSIX sysconf instead.

details:   /var/hg/gmp/rev/fd277ad6f04a
changeset: 18172:fd277ad6f04a
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:48:16 2020 +0200
description:
(tests_start): Fall back from snprintf to sprintf for C90.

details:   /var/hg/gmp/rev/a96669761396
changeset: 18173:a96669761396
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:51:39 2020 +0200
description:
Use local str_casecmp instead of non-standard strcasecmp.

details:   /var/hg/gmp/rev/8a498b1af11e
changeset: 18174:8a498b1af11e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:52:52 2020 +0200
description:
Avoid using non-standard function fileno().

details:   /var/hg/gmp/rev/084124600500
changeset: 18175:084124600500
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:53:30 2020 +0200
description:
Avoid using non-standard function fileno().

details:   /var/hg/gmp/rev/3174b4779f7d
changeset: 18176:3174b4779f7d
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 11:57:50 2020 +0200
description:
(main): Cast printf args to right type.  (_POSIX_C_SOURCE): Define.

details:   /var/hg/gmp/rev/a29cacf91792
changeset: 18177:a29cacf91792
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:00:41 2020 +0200
description:
C90 compliance.

details:   /var/hg/gmp/rev/f651effdded0
changeset: 18178:f651effdded0
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:02:30 2020 +0200
description:
(speed_endtime): Cast printf args to right type.  (_POSIX_C_SOURCE): Define.

details:   /var/hg/gmp/rev/0851dcad8646
changeset: 18179:0851dcad8646
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:04:15 2020 +0200
description:
Back out 2020-01-10 change to comply to C90.

details:   /var/hg/gmp/rev/7ea230018004
changeset: 18180:7ea230018004
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Thu May 21 12:08:01 2020 +0200
description:
C90 compliance.

details:   /var/hg/gmp/rev/4db2f67ded6f
changeset: 18181:4db2f67ded6f
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Mon May 25 00:58:38 2020 +0200
description:
Use reference parameter for 'catch'.

details:   /var/hg/gmp/rev/dd3cf640669e
changeset: 18182:dd3cf640669e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Sat Jun 27 09:46:38 2020 +0200
description:
Replace old copyright headers to agree with current GMP license terms.

details:   /var/hg/gmp/rev/b03b3cb1ce98
changeset: 18183:b03b3cb1ce98
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Nov 16 21:41:15 2020 +0100
description:
Added tag gmp-6.2.0 for changeset 413ede7e6962

diffstat:

 .hgtags                                                     |   1 +
 gmp-impl.h                                                  |  14 +-
 mini-gmp/tests/hex-random.h                                 |   2 +-
 mini-gmp/tests/t-double.c                                   |   6 +-
 mini-gmp/tests/t-mpq_muldiv_2exp.c                          |   2 +-
 mpn/arm64/lshift.asm                                        |  31 ++++--
 mpn/arm64/lshiftc.asm                                       |  31 ++++--
 mpn/arm64/rshift.asm                                        |  31 ++++--
 mpn/generic/compute_powtab.c                                |  24 +++-
 mpn/generic/gcd_22.c                                        |   2 +-
 mpn/generic/get_d.c                                         |   2 +-
 mpn/generic/get_str.c                                       |   4 +-
 mpn/generic/mod_1_1.c                                       |   2 +-
 mpn/generic/set_str.c                                       |   6 +-
 mpn/generic/toom_interpolate_12pts.c                        |  58 ++++++------
 mpn/generic/toom_interpolate_16pts.c                        |  34 ++++---
 mpn/powerpc64/mode64/p9/addmul_2.asm                        |  31 ++++--
 mpn/powerpc64/mode64/p9/mul_2.asm                           |  31 ++++--
 mpz/mul.c                                                   |  16 ++-
 tests/cxx/t-assign.cc                                       |  12 +-
 tests/cxx/t-constr.cc                                       |  28 +++---
 tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc |   2 +-
 tests/cxx/t-ops2z.cc                                        |  14 +-
 tests/cxx/t-rand.cc                                         |   2 +-
 tests/devel/try.c                                           |  11 +-
 tests/misc.c                                                |   9 +-
 tests/mpn/t-gcd_11.c                                        |   3 +
 tests/mpn/t-gcd_22.c                                        |   3 +
 tests/mpn/t-gcdext_1.c                                      |   3 +
 tests/mpz/convert.c                                         |  19 ++++-
 tests/mpz/reuse.c                                           |   6 +-
 tests/refmpn.c                                              |   4 +-
 tests/spinner.c                                             |   2 +-
 tune/speed.c                                                |   6 +-
 tune/speed.h                                                |   6 +-
 tune/time.c                                                 |  17 ++-
 tune/tune-gcd-p.c                                           |   3 +-
 tune/tuneup.c                                               |  19 +++-
 38 files changed, 312 insertions(+), 185 deletions(-)

diffs (truncated from 1311 to 300 lines):

diff -r 970b7221873f -r b03b3cb1ce98 .hgtags
--- a/.hgtags	Mon Nov 16 19:48:04 2020 +0100
+++ b/.hgtags	Mon Nov 16 21:41:15 2020 +0100
@@ -12,3 +12,4 @@
 4b14ab8c899a5edd7be6bf0f1a9a04aef8958825 rel-5.1.0
 e10ffb0afa6b6728f59cf90dd1584cdd00fe4a3a rel-5.1.1
 89a2bc9b845cf825aec3ad77c98cae318d91a7d7 gmp-6.1.0
+413ede7e69620f4ddc4cb3f431e9343da73469f6 gmp-6.2.0
diff -r 970b7221873f -r b03b3cb1ce98 gmp-impl.h
--- a/gmp-impl.h	Mon Nov 16 19:48:04 2020 +0100
+++ b/gmp-impl.h	Mon Nov 16 21:41:15 2020 +0100
@@ -289,13 +289,13 @@
 #endif
 
 #if ! HAVE_MEMSET
-#define memset(p, c, n)			\
-  do {					\
-    ASSERT ((n) >= 0);			\
-    char *__memset__p = (p);		\
-    int	 __i;				\
-    for (__i = 0; __i < (n); __i++)	\
-      __memset__p[__i] = (c);		\
+#define memset(p, c, n)						\
+  do {								\
+    unsigned char *__memset__p = (unsigned char *) (p);		\
+    int	 __i;							\
+    ASSERT ((n) >= 0);						\
+    for (__i = 0; __i < (n); __i++)				\
+      __memset__p[__i] = (c);					\
   } while (0)
 #endif
 
diff -r 970b7221873f -r b03b3cb1ce98 mini-gmp/tests/hex-random.h
--- a/mini-gmp/tests/hex-random.h	Mon Nov 16 19:48:04 2020 +0100
+++ b/mini-gmp/tests/hex-random.h	Mon Nov 16 21:41:15 2020 +0100
@@ -26,7 +26,7 @@
     OP_TDIV_Q_2,  OP_TDIV_R_2,
     OP_GCD, OP_LCM, OP_POWM, OP_AND, OP_IOR, OP_XOR,
     OP_SETBIT, OP_CLRBIT, OP_COMBIT,
-    OP_SCAN0, OP_SCAN1,
+    OP_SCAN0, OP_SCAN1
   };
 
 void hex_random_init (void);
diff -r 970b7221873f -r b03b3cb1ce98 mini-gmp/tests/t-double.c
--- a/mini-gmp/tests/t-double.c	Mon Nov 16 19:48:04 2020 +0100
+++ b/mini-gmp/tests/t-double.c	Mon Nov 16 21:41:15 2020 +0100
@@ -1,6 +1,6 @@
 /*
 
-Copyright 2012, 2013, 2018 Free Software Foundation, Inc.
+Copyright 2012, 2013, 2018, 2020 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library test suite.
 
@@ -118,6 +118,10 @@
   mpz_clear (y);
 }
 
+#ifndef M_PI
+#define M_PI 3.141592653589793238462643383279502884
+#endif
+
 static const struct
 {
   double d;
diff -r 970b7221873f -r b03b3cb1ce98 mini-gmp/tests/t-mpq_muldiv_2exp.c
--- a/mini-gmp/tests/t-mpq_muldiv_2exp.c	Mon Nov 16 19:48:04 2020 +0100
+++ b/mini-gmp/tests/t-mpq_muldiv_2exp.c	Mon Nov 16 21:41:15 2020 +0100
@@ -100,7 +100,7 @@
 	  || mpz_sizeinbase (t, 2) - 1 != e || mpz_cmp_ui (mpq_denref (aq), 1) != 0)
 	{
 	  fprintf (stderr, "mpq_div_2exp failed: %lu\n", e);
-	  fprintf (stderr, "%li %li %lu %zu\n", e2, t2, mpz_scan1 (t, 0), mpz_sizeinbase (t, 2));
+	  fprintf (stderr, "%li %li %lu %lu\n", e2, t2, mpz_scan1 (t, 0), (unsigned long) mpz_sizeinbase (t, 2));
 	  dump ("na", a);
 	  dump ("da", b);
 	  dump ("nr", mpq_numref (rq));
diff -r 970b7221873f -r b03b3cb1ce98 mpn/arm64/lshift.asm
--- a/mpn/arm64/lshift.asm	Mon Nov 16 19:48:04 2020 +0100
+++ b/mpn/arm64/lshift.asm	Mon Nov 16 21:41:15 2020 +0100
@@ -3,19 +3,30 @@
 dnl  Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff -r 970b7221873f -r b03b3cb1ce98 mpn/arm64/lshiftc.asm
--- a/mpn/arm64/lshiftc.asm	Mon Nov 16 19:48:04 2020 +0100
+++ b/mpn/arm64/lshiftc.asm	Mon Nov 16 21:41:15 2020 +0100
@@ -3,19 +3,30 @@
 dnl  Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff -r 970b7221873f -r b03b3cb1ce98 mpn/arm64/rshift.asm
--- a/mpn/arm64/rshift.asm	Mon Nov 16 19:48:04 2020 +0100
+++ b/mpn/arm64/rshift.asm	Mon Nov 16 21:41:15 2020 +0100
@@ -3,19 +3,30 @@
 dnl  Copyright 2013, 2014, 2017 Free Software Foundation, Inc.
 
 dnl  This file is part of the GNU MP Library.
-
+dnl
 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU Lesser General Public License as published
-dnl  by the Free Software Foundation; either version 3 of the License, or (at
-dnl  your option) any later version.
-
+dnl  it under the terms of either:
+dnl
+dnl    * the GNU Lesser General Public License as published by the Free
+dnl      Software Foundation; either version 3 of the License, or (at your
+dnl      option) any later version.
+dnl
+dnl  or
+dnl
+dnl    * the GNU General Public License as published by the Free Software
+dnl      Foundation; either version 2 of the License, or (at your option) any
+dnl      later version.
+dnl
+dnl  or both in parallel, as here.
+dnl
 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-dnl  License for more details.
-
-dnl  You should have received a copy of the GNU Lesser General Public License
-dnl  along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
+dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl  for more details.
+dnl
+dnl  You should have received copies of the GNU General Public License and the
+dnl  GNU Lesser General Public License along with the GNU MP Library.  If not,
+dnl  see https://www.gnu.org/licenses/.
 
 include(`../config.m4')
 
diff -r 970b7221873f -r b03b3cb1ce98 mpn/generic/compute_powtab.c
--- a/mpn/generic/compute_powtab.c	Mon Nov 16 19:48:04 2020 +0100
+++ b/mpn/generic/compute_powtab.c	Mon Nov 16 21:41:15 2020 +0100
@@ -70,6 +70,8 @@
   mp_limb_t cy;
   long start_idx;
   int c;
+  mp_size_t shift;
+  long pi;
 
   mp_limb_t big_base = mp_bases[base].big_base;
   int chars_per_limb = mp_bases[base].chars_per_limb;
@@ -97,7 +99,7 @@
   c = t[0] == 0;
   t += c;
   n -= c;
-  mp_size_t shift = c;
+  shift = c;
 
   SET_powers_t (pt[0], t, n, digits_in_base, base, shift);
   p = t;
@@ -139,7 +141,7 @@
       start_idx = n_pows - 3;
     }
 
-  for (long pi = start_idx; pi >= 0; pi--)
+  for (pi = start_idx; pi >= 0; pi--)
     {
       t = powtab_mem_ptr;
       powtab_mem_ptr += 2 * n + 2;
@@ -214,6 +216,10 @@
 
   powers_t *pt = powtab;
 
+  mp_size_t n = 1;
+  mp_size_t shift = 0;
+  long pi;
+
   p = powtab_mem_ptr;
   powtab_mem_ptr += 1;
   p[0] = big_base;
@@ -221,9 +227,7 @@
   SET_powers_t (pt[0], p, 1, digits_in_base, base, 0);
   pt++;
 
-  mp_size_t n = 1;
-  mp_size_t shift = 0;
-  for (long pi = n_pows - 1; pi >= 0; pi--)
+  for (pi = n_pows - 1; pi >= 0; pi--)
     {
       t = powtab_mem_ptr;
       powtab_mem_ptr += 2 * n;
@@ -271,7 +275,7 @@
 
   /* Strip any remaining low zero limbs.  */
   pt -= n_pows + 1;
-  for (long pi = n_pows; pi >= 0; pi--)
+  for (pi = n_pows; pi >= 0; pi--)
     {
       mp_ptr t = pt[pi].p;
       mp_size_t shift = pt[pi].shift;
@@ -293,7 +297,8 @@
 {
   int chars_per_limb = mp_bases[base].chars_per_limb;
   long n_pows = 0;
-  for (size_t pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
+  size_t pn;
+  for (pn = (un + 1) >> 1; pn != 1; pn = (pn + 1) >> 1)
     {
       exptab[n_pows] = pn * chars_per_limb;
       n_pows++;
@@ -301,11 +306,13 @@
   exptab[n_pows] = chars_per_limb;
 
 #if HAVE_mpn_compute_powtab_mul && HAVE_mpn_compute_powtab_div
+  {
   size_t pn = un - 1;
   size_t xn = (un + 1) >> 1;
   unsigned mcost = 1;
   unsigned dcost = 1;
-  for (long i = n_pows - 2; i >= 0; i--)
+  long i;
+  for (i = n_pows - 2; i >= 0; i--)
     {
       size_t pow = (pn >> (i + 1)) + 1;
 
@@ -332,6 +339,7 @@
     return n_pows;
   else
     return -n_pows;



More information about the gmp-commit mailing list