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

mercurial at gmplib.org mercurial at gmplib.org
Wed Jan 2 22:48:16 UTC 2019


details:   /var/hg/gmp/rev/506da722702e
changeset: 17748:506da722702e
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Tue Jan 01 18:24:31 2019 +0100
description:
Fix a comment.

details:   /var/hg/gmp/rev/f47a94a3f281
changeset: 17749:f47a94a3f281
user:      Torbjorn Granlund <tg at gmplib.org>
date:      Wed Jan 02 23:48:14 2019 +0100
description:
Trivial merge.

diffstat:

 mini-gmp/mini-gmp.c                      |  19 ++++++++-----------
 mini-gmp/tests/t-lucm.c                  |   2 --
 mini-gmp/tests/testutils.c               |   7 +++++++
 mini-gmp/tests/testutils.h               |   4 +---
 mpn/powerpc64/mode64/p9/mul_basecase.asm |   2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

diffs (114 lines):

diff -r ba431100f429 -r f47a94a3f281 mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Fri Dec 21 07:01:55 2018 +0100
+++ b/mini-gmp/mini-gmp.c	Wed Jan 02 23:48:14 2019 +0100
@@ -130,13 +130,13 @@
 #define gmp_umul_ppmm(w1, w0, u, v)					\
   do {									\
     int LOCAL_GMP_LIMB_BITS = GMP_LIMB_BITS;				\
-    if (sizeof (unsigned int) >= 2 * sizeof (mp_limb_t))		\
+    if (sizeof(unsigned int) * CHAR_BIT >= 2 * GMP_LIMB_BITS)		\
       {									\
 	unsigned int __ww = (unsigned int) (u) * (v);			\
 	w0 = (mp_limb_t) __ww;						\
 	w1 = (mp_limb_t) (__ww >> LOCAL_GMP_LIMB_BITS);			\
       }									\
-    else if (sizeof (unsigned long int) >= 2 * sizeof (mp_limb_t))	\
+    else if (GMP_ULONG_BITS >= 2 * GMP_LIMB_BITS)			\
       {									\
 	unsigned long int __ww = (unsigned long int) (u) * (v);		\
 	w0 = (mp_limb_t) __ww;						\
@@ -1550,8 +1550,8 @@
 int
 mpz_fits_slong_p (const mpz_t u)
 {
-    return (LONG_MAX + LONG_MIN == 0 || mpz_cmp_ui (u, LONG_MAX) <= 0) &&
-      mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, LONG_MIN)) <= 0;
+  return (LONG_MAX + LONG_MIN == 0 || mpz_cmp_ui (u, LONG_MAX) <= 0) &&
+    mpz_cmpabs_ui (u, GMP_NEG_CAST (unsigned long int, LONG_MIN)) <= 0;
 }
 
 static int
@@ -1571,7 +1571,7 @@
 {
   mp_size_t us = u->_mp_size;
 
-    return us >= 0 && mpn_absfits_ulong_p (u->_mp_d, us);
+  return us >= 0 && mpn_absfits_ulong_p (u->_mp_d, us);
 }
 
 long int
@@ -3400,11 +3400,8 @@
 /* with P=1, Q=Q; k = (n>>b0)|1. */
 /* Requires an odd n > 4; b0 > 0; -2*Q must not overflow a long */
 /* Returns (U_k == 0) and sets V=V_k and Qk=Q^k. */
-#ifndef __MINI_GMP_TESTING
-static
-#endif
-int
-mpz_lucas_mod (mpz_t V, mpz_t Qk, long Q,
+static int
+gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q,
 	       mp_bitcnt_t b0, const mpz_t n)
 {
   mp_bitcnt_t bs;
@@ -3504,7 +3501,7 @@
   /* D= P^2 - 4Q; P = 1; Q = (1-D)/4 */
   Q = (D & 2) ? (D >> 2) + 1 : -(long) (D >> 2);
 
-  if (! mpz_lucas_mod (V, Qk, Q, b0, n))	/* If Ud != 0 */
+  if (! gmp_lucas_mod (V, Qk, Q, b0, n))	/* If Ud != 0 */
     while (V->_mp_size != 0 && --b0 != 0)	/* while Vk != 0 */
       /* V <- V ^ 2 - 2Q^k */
       /* Q^{2k} = (Q^k)^2 */
diff -r ba431100f429 -r f47a94a3f281 mini-gmp/tests/t-lucm.c
--- a/mini-gmp/tests/t-lucm.c	Fri Dec 21 07:01:55 2018 +0100
+++ b/mini-gmp/tests/t-lucm.c	Wed Jan 02 23:48:14 2019 +0100
@@ -24,8 +24,6 @@
 
 #include "testutils.h"
 
-int mpz_lucas_mod (mpz_t, mpz_t, long, mp_bitcnt_t, const mpz_t);
-
 #define MAXBITS 100
 #define COUNT 1000
 
diff -r ba431100f429 -r f47a94a3f281 mini-gmp/tests/testutils.c
--- a/mini-gmp/tests/testutils.c	Fri Dec 21 07:01:55 2018 +0100
+++ b/mini-gmp/tests/testutils.c	Wed Jan 02 23:48:14 2019 +0100
@@ -172,3 +172,10 @@
       abort();
     }
 }
+
+int
+mpz_lucas_mod (mpz_t V, mpz_t Qk, long Q,
+	       mp_bitcnt_t b0, const mpz_t n)
+{
+  return gmp_lucas_mod (V, Qk, Q, b0, n);
+}
diff -r ba431100f429 -r f47a94a3f281 mini-gmp/tests/testutils.h
--- a/mini-gmp/tests/testutils.h	Fri Dec 21 07:01:55 2018 +0100
+++ b/mini-gmp/tests/testutils.h	Wed Jan 02 23:48:14 2019 +0100
@@ -36,9 +36,7 @@
 void
 mpz_set_str_or_abort (mpz_ptr z, const char *str, int base);
 
-/* Prototype for functions that have one only for the tests. */
-#define __MINI_GMP_TESTING 1
-
+/* Prototype for wrappers to internal functions to be tested. */
 int
 mpz_lucas_mod (mpz_t V, mpz_t Qk, long Q,
 	       mp_bitcnt_t b0, const mpz_t n);
diff -r ba431100f429 -r f47a94a3f281 mpn/powerpc64/mode64/p9/mul_basecase.asm
--- a/mpn/powerpc64/mode64/p9/mul_basecase.asm	Fri Dec 21 07:01:55 2018 +0100
+++ b/mpn/powerpc64/mode64/p9/mul_basecase.asm	Wed Jan 02 23:48:14 2019 +0100
@@ -46,7 +46,7 @@
 C    and make the tail code more manageable.
 C  * Postpone some register saves to main loop.
 C  * Perhaps write more small operands (3x1, 3x2, 3x3) code.
-C  * Consider restoring rp,up after loop using arithmetic, eliminating r20,r21.
+C  * Consider restoring rp,up after loop using arithmetic, eliminating rp2, up2.
 C    On the other hand, the current rp,up restore register are useful for OSP.
 C  * Do OSP. This should save a lot with the current deep addmul_2 pipeline.
 


More information about the gmp-commit mailing list