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

mercurial at gmplib.org mercurial at gmplib.org
Tue Feb 1 08:59:05 CET 2022


details:   /var/hg/gmp/rev/df502ac1fb62
changeset: 18296:df502ac1fb62
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Wed Jan 12 22:11:16 2022 +0100
description:
tune/speed.c: Add FLAG_NODATA for gmp_primesieve

details:   /var/hg/gmp/rev/1b8402f6cc22
changeset: 18297:1b8402f6cc22
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Feb 01 08:55:10 2022 +0100
description:
mpz/aorsmul_i.c: Use MPZ_NEWALLOC when the operand is overwritten

details:   /var/hg/gmp/rev/813f37bab298
changeset: 18298:813f37bab298
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Feb 01 08:57:43 2022 +0100
description:
mpz/import.c: Reorder branches

details:   /var/hg/gmp/rev/89eae0fedb5a
changeset: 18299:89eae0fedb5a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Feb 01 08:58:23 2022 +0100
description:
Trivial merge

diffstat:

 ChangeLog       |   4 ++++
 doc/gmp.texi    |  13 ++++++++-----
 mpz/aorsmul_i.c |   5 +++--
 mpz/import.c    |  33 ++++++++++++---------------------
 tune/speed.c    |   2 +-
 5 files changed, 28 insertions(+), 29 deletions(-)

diffs (136 lines):

diff -r b14bd5e2ea0a -r 89eae0fedb5a ChangeLog
--- a/ChangeLog	Wed Jan 05 18:19:17 2022 +0100
+++ b/ChangeLog	Tue Feb 01 08:58:23 2022 +0100
@@ -1,3 +1,7 @@
+2022-01-20  Marc Glisse  <marc.glisse at inria.fr>
+
+	* doc/gmp.texi: Clarify C++ includes and library.
+
 2022-01-05 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* gen-sieve.c: Generate masks depending on bit size.
diff -r b14bd5e2ea0a -r 89eae0fedb5a doc/gmp.texi
--- a/doc/gmp.texi	Wed Jan 05 18:19:17 2022 +0100
+++ b/doc/gmp.texi	Tue Feb 01 08:58:23 2022 +0100
@@ -1860,7 +1860,9 @@
 @cindex Include files
 @cindex @code{#include}
 All declarations needed to use GMP are collected in the include file
- at file{gmp.h}.  It is designed to work with both C and C++ compilers.
+ at file{gmp.h}, except for the @ref{C++ Class Interface} which comes with its
+own separate header @file{gmpxx.h}.  @file{gmp.h} is designed to work with
+both C and C++ compilers.
 
 @example
 #include <gmp.h>
@@ -1868,7 +1870,7 @@
 
 @cindex @code{stdio.h}
 Note however that prototypes for GMP functions with @code{FILE *} parameters
-are only provided if @code{<stdio.h>} is included too.
+are only provided if @code{<stdio.h>} is included before.
 
 @example
 #include <stdio.h>
@@ -1892,9 +1894,10 @@
 @end example
 
 @cindex @code{libgmpxx}
-GMP C++ functions are in a separate @file{libgmpxx} library.  This is built
-and installed if C++ support has been enabled (@pxref{Build Options}).  For
-example,
+GMP C++ functions are in a separate @file{libgmpxx} library, including the
+ at ref{C++ Class Interface} but also @ref{C++ Formatted Output} for regular
+GMP types.  This is built and installed if C++ support has been enabled
+(@pxref{Build Options}).  For example,
 
 @example
 g++ mycxxprog.cc -lgmpxx -lgmp
diff -r b14bd5e2ea0a -r 89eae0fedb5a mpz/aorsmul_i.c
--- a/mpz/aorsmul_i.c	Wed Jan 05 18:19:17 2022 +0100
+++ b/mpz/aorsmul_i.c	Tue Feb 01 08:58:23 2022 +0100
@@ -4,7 +4,8 @@
    ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
    COMPLETELY IN FUTURE GNU MP RELEASES.
 
-Copyright 2001, 2002, 2004, 2005, 2012, 2021 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2004, 2005, 2012, 2021, 2022 Free Software
+Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -85,7 +86,7 @@
   if (wsize_signed == 0)
     {
       /* nothing to add to, just set x*y, "sub" gives the sign */
-      wp = MPZ_REALLOC (w, xsize+1);
+      wp = MPZ_NEWALLOC (w, xsize+1);
       cy = mpn_mul_1 (wp, PTR(x), xsize, y);
       wp[xsize] = cy;
       xsize += (cy != 0);
diff -r b14bd5e2ea0a -r 89eae0fedb5a mpz/import.c
--- a/mpz/import.c	Wed Jan 05 18:19:17 2022 +0100
+++ b/mpz/import.c	Tue Feb 01 08:58:23 2022 +0100
@@ -1,6 +1,6 @@
 /* mpz_import -- set mpz from word data.
 
-Copyright 2002, 2012, 2021 Free Software Foundation, Inc.
+Copyright 2002, 2012, 2021, 2022 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
@@ -68,31 +68,22 @@
       && size == sizeof (mp_limb_t)
       && (((char *) data - (char *) NULL) % sizeof (mp_limb_t)) == 0 /* align */)
     {
-      if (order == -1 && endian == HOST_ENDIAN)
+      if (order == -1)
 	{
-	  MPN_COPY (zp, (mp_srcptr) data, (mp_size_t) count);
-	  goto done;
-	}
-
-      if (order == -1 && endian == - HOST_ENDIAN)
-	{
-	  MPN_BSWAP (zp, (mp_srcptr) data, (mp_size_t) count);
-	  goto done;
+	  if (endian == HOST_ENDIAN)
+	    MPN_COPY (zp, (mp_srcptr) data, (mp_size_t) count);
+	  else /* if (endian == - HOST_ENDIAN) */
+	    MPN_BSWAP (zp, (mp_srcptr) data, (mp_size_t) count);
 	}
-
-      if (order == 1 && endian == HOST_ENDIAN)
+      else /* if (order == 1) */
 	{
-	  MPN_REVERSE (zp, (mp_srcptr) data, (mp_size_t) count);
-	  goto done;
-	}
-
-      if (order == 1 && endian == -HOST_ENDIAN)
-	{
-	  MPN_BSWAP_REVERSE (zp, (mp_srcptr) data, (mp_size_t) count);
-	  goto done;
+	  if (endian == HOST_ENDIAN)
+	    MPN_REVERSE (zp, (mp_srcptr) data, (mp_size_t) count);
+	  else /* if (endian == - HOST_ENDIAN) */
+	    MPN_BSWAP_REVERSE (zp, (mp_srcptr) data, (mp_size_t) count);
 	}
     }
-
+  else
   {
     mp_limb_t      limb, byte, wbitsmask;
     size_t         i, j, numb, wbytes;
diff -r b14bd5e2ea0a -r 89eae0fedb5a tune/speed.c
--- a/tune/speed.c	Wed Jan 05 18:19:17 2022 +0100
+++ b/tune/speed.c	Tue Feb 01 08:58:23 2022 +0100
@@ -321,7 +321,7 @@
   { "mpn_gcdext_lehmer",     speed_mpn_gcdext_lehmer     },
 #endif
 
-  { "gmp_primesieve",    speed_gmp_primesieve       },
+  { "gmp_primesieve",    speed_gmp_primesieve, FLAG_NODATA      },
   { "mpz_nextprime",     speed_mpz_nextprime        },
   { "mpz_nextprime_1",   speed_mpz_nextprime_1, FLAG_R_OPTIONAL },
   { "mpz_prevprime",     speed_mpz_prevprime        },


More information about the gmp-commit mailing list