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

mercurial at gmplib.org mercurial at gmplib.org
Wed Jan 25 10:16:18 CET 2012


details:   /var/hg/gmp/rev/7ce47eaf9e7e
changeset: 14576:7ce47eaf9e7e
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Jan 25 10:10:24 2012 +0100
description:
Add forgotten year.

details:   /var/hg/gmp/rev/00e777b6af0a
changeset: 14577:00e777b6af0a
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Jan 25 10:11:39 2012 +0100
description:
Remove unused tuneup variables.

details:   /var/hg/gmp/rev/a04e337d10b9
changeset: 14578:a04e337d10b9
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Jan 25 10:13:36 2012 +0100
description:
Correct a comment.

details:   /var/hg/gmp/rev/e430dc4d7b7c
changeset: 14579:e430dc4d7b7c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Jan 25 10:14:59 2012 +0100
description:
Remove extra ';'.

details:   /var/hg/gmp/rev/6a0df7c806ad
changeset: 14580:6a0df7c806ad
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Wed Jan 25 10:16:15 2012 +0100
description:
Trivial merge.

diffstat:

 ChangeLog     |   8 ++++++++
 acinclude.m4  |   4 ++--
 doc/gmp.texi  |   8 ++++----
 gmp-impl.h    |   3 +--
 mpz/fac_ui.c  |  50 +++++++++++++++++++++++++++-----------------------
 tune/tuneup.c |   2 --
 6 files changed, 42 insertions(+), 33 deletions(-)

diffs (213 lines):

diff -r fa8fec94b348 -r 6a0df7c806ad ChangeLog
--- a/ChangeLog	Tue Jan 17 16:03:06 2012 +0100
+++ b/ChangeLog	Wed Jan 25 10:16:15 2012 +0100
@@ -1,3 +1,11 @@
+2012-01-20 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpz/fac_ui.h: Reduce branches in basecases.
+
+2012-01-18  Marc Glisse  <marc.glisse at inria.fr>
+
+	* doc/gmp.texi (mpf_class::mpf_class): Use mp_bitcnt_t.
+
 2012-01-17  Torbjorn Granlund  <tege at gmplib.org>
 
 	* configure.in: Add ultrasparc T4 support.
diff -r fa8fec94b348 -r 6a0df7c806ad acinclude.m4
--- a/acinclude.m4	Tue Jan 17 16:03:06 2012 +0100
+++ b/acinclude.m4	Wed Jan 25 10:16:15 2012 +0100
@@ -1,8 +1,8 @@
 dnl  GMP specific autoconf macros
 
 
-dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 Free Software
-dnl  Foundation, Inc.
+dnl  Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 Free
+dnl  Software Foundation, Inc.
 dnl
 dnl  This file is part of the GNU MP Library.
 dnl
diff -r fa8fec94b348 -r 6a0df7c806ad doc/gmp.texi
--- a/doc/gmp.texi	Tue Jan 17 16:03:06 2012 +0100
+++ b/doc/gmp.texi	Wed Jan 25 10:16:15 2012 +0100
@@ -6685,7 +6685,7 @@
 doesn't suit.
 
 @deftypefun {} mpf_class::mpf_class (type @var{op})
- at deftypefunx {} mpf_class::mpf_class (type @var{op}, unsigned long @var{prec})
+ at deftypefunx {} mpf_class::mpf_class (type @var{op}, mp_bitcnt_t @var{prec})
 Construct an @code{mpf_class}.  Any standard C++ type can be used, except
 @code{long long} and @code{long double}, and any of the GMP C++ classes can be
 used.
@@ -6709,7 +6709,7 @@
 @end deftypefun
 
 @deftypefun explicit mpf_class::mpf_class (mpf_t @var{f})
- at deftypefunx {} mpf_class::mpf_class (mpf_t @var{f}, unsigned long @var{prec})
+ at deftypefunx {} mpf_class::mpf_class (mpf_t @var{f}, mp_bitcnt_t @var{prec})
 Construct an @code{mpf_class} from an @code{mpf_t}.  The value in @var{f} is
 copied into the new @code{mpf_class}, there won't be any permanent association
 between it and @var{f}.
@@ -6719,9 +6719,9 @@
 @end deftypefun
 
 @deftypefun explicit mpf_class::mpf_class (const char *@var{s})
- at deftypefunx {} mpf_class::mpf_class (const char *@var{s}, unsigned long @var{prec}, int @var{base} = 0)
+ at deftypefunx {} mpf_class::mpf_class (const char *@var{s}, mp_bitcnt_t @var{prec}, int @var{base} = 0)
 @deftypefunx explicit mpf_class::mpf_class (const string& @var{s})
- at deftypefunx {} mpf_class::mpf_class (const string& @var{s}, unsigned long @var{prec}, int @var{base} = 0)
+ at deftypefunx {} mpf_class::mpf_class (const string& @var{s}, mp_bitcnt_t @var{prec}, int @var{base} = 0)
 Construct an @code{mpf_class} converted from a string using @code{mpf_set_str}
 (@pxref{Assigning Floats}).  If @var{prec} is given, the initial precision is
 that value, in bits.  If not, the default @code{mpf} precision
diff -r fa8fec94b348 -r 6a0df7c806ad gmp-impl.h
--- a/gmp-impl.h	Tue Jan 17 16:03:06 2012 +0100
+++ b/gmp-impl.h	Wed Jan 25 10:16:15 2012 +0100
@@ -2666,8 +2666,7 @@
 #endif
 
 
-/* Structure for conversion between internal binary format and
-   strings in base 2..36.  */
+/* Structure for conversion between internal binary format and strings.  */
 struct bases
 {
   /* Number of digits in the conversion base that always fits in an mp_limb_t.
diff -r fa8fec94b348 -r 6a0df7c806ad mpz/fac_ui.c
--- a/mpz/fac_ui.c	Tue Jan 17 16:03:06 2012 +0100
+++ b/mpz/fac_ui.c	Wed Jan 25 10:16:15 2012 +0100
@@ -334,7 +334,7 @@
 
     cy = mpn_mul_1 (prod, factors, size, factors[i]);
     prod[size] = cy;
-    SIZ (x) = size + (cy != 0);;
+    SIZ (x) = size + (cy != 0);
   } else {
     mpz_t x1, x2;
     TMP_DECL;
@@ -472,7 +472,6 @@
       PTR (x)[0] = prod;
       SIZ (x) = 1;
     }
-
 }
 
 #undef SWING_A_PRIME
@@ -524,7 +523,7 @@
     }
   else
     {
-      unsigned s;
+      unsigned   s;
       mp_limb_t *factors;
 
       ASSERT (n <= GMP_NUMB_MAX);
@@ -532,10 +531,9 @@
       s = 0;
       {
 	mp_limb_t tn;
-	mp_limb_t prod, max_prod, i, j;
+	unsigned  j;
 	TMP_SDECL;
 
-	ASSERT (numberof (tablef) > 3);
 #if TUNE_PROGRAM_BUILD
 	ASSERT (FAC_DSC_THRESHOLD_LIMIT >= FAC_DSC_THRESHOLD);
 #endif
@@ -545,28 +543,36 @@
 	  tn >>= 1;
 
 	j = 0;
-	prod = 1;
 
 	TMP_SMARK;
 	factors = TMP_SALLOC_LIMBS (1 + tn / FACTORS_PER_LIMB);
+	ASSERT (tn >= FACTORS_PER_LIMB);
 
+	if (tn >= numberof (tabled) * 2 + 1) {
+	  mp_limb_t prod, max_prod, i;
+
+	  prod = 1;
 #if TUNE_PROGRAM_BUILD
-	max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD_LIMIT;
+	  max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD_LIMIT;
 #else
-	max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD;
+	  max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD;
 #endif
-	for (; (tn - 1) >> 1 >= numberof (tabled); tn >>= 1) {
-	  i = numberof (tabled) * 2 + 1;
-	  factors[j++] = tabled[numberof (tabled) - 1];
+
 	  do {
-	    FACTOR_LIST_STORE (i, prod, max_prod, factors, j);
-	    i += 2;
-	  } while (i <= tn);
-	  max_prod <<= 1;
+	    i = numberof (tabled) * 2 + 1;
+	    factors[j++] = tabled[numberof (tabled) - 1];
+	    do {
+	      FACTOR_LIST_STORE (i, prod, max_prod, factors, j);
+	      i += 2;
+	    } while (i <= tn);
+	    max_prod <<= 1;
+	    tn >>= 1;
+	  } while (tn >= numberof (tabled) * 2 + 1);
+
+	  factors[j++] = prod;
 	}
 
-	factors[j] = prod;
-	j += prod > 1;
+	ASSERT (numberof (tablef) > numberof (tabled));
 	factors[j++] = tabled[(tn - 1) >> 1];
 	factors[j++] = tablef[tn >> 1];
 	mpz_prodlimbs (x, factors, j);
@@ -633,24 +639,22 @@
     }
   else if (BELOW_THRESHOLD (n, FAC_ODD_THRESHOLD))
     {
-      mp_limb_t *factors, prod, max_prod, i, j;
+      mp_limb_t *factors, prod, max_prod, j;
       TMP_SDECL;
 
       TMP_SMARK;
-      i = numberof (table);
       factors = TMP_SALLOC_LIMBS (2 + (n - numberof (table)) / FACTORS_PER_LIMB);
 
       factors[0] = table[numberof (table)-1];
       j = 1;
-      prod = 1;
+      prod = n;
 #if TUNE_PROGRAM_BUILD
       max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD_LIMIT;
 #else
       max_prod = GMP_NUMB_MAX / (FAC_ODD_THRESHOLD | 1);
 #endif
-      do {
-	FACTOR_LIST_STORE (i, prod, max_prod, factors, j);
-      } while (++i <= n);
+      for (; --n >= numberof (table);)
+	FACTOR_LIST_STORE (n, prod, max_prod, factors, j);
 
       factors[j++] = prod;
       mpz_prodlimbs (x, factors, j);
diff -r fa8fec94b348 -r 6a0df7c806ad tune/tuneup.c
--- a/tune/tuneup.c	Tue Jan 17 16:03:06 2012 +0100
+++ b/tune/tuneup.c	Wed Jan 25 10:16:15 2012 +0100
@@ -173,7 +173,6 @@
 mp_size_t  mulmid_toom42_threshold      = MP_SIZE_T_MAX;
 mp_size_t  mulmod_bnm1_threshold        = MP_SIZE_T_MAX;
 mp_size_t  sqrmod_bnm1_threshold        = MP_SIZE_T_MAX;
-mp_size_t  div_sb_preinv_threshold      = MP_SIZE_T_MAX;
 mp_size_t  div_qr_2_pi2_threshold       = MP_SIZE_T_MAX;
 mp_size_t  dc_div_qr_threshold          = MP_SIZE_T_MAX;
 mp_size_t  dc_divappr_q_threshold       = MP_SIZE_T_MAX;
@@ -196,7 +195,6 @@
 mp_size_t  hgcd_threshold               = MP_SIZE_T_MAX;
 mp_size_t  hgcd_appr_threshold          = MP_SIZE_T_MAX;
 mp_size_t  hgcd_reduce_threshold        = MP_SIZE_T_MAX;
-mp_size_t  gcd_accel_threshold          = MP_SIZE_T_MAX;
 mp_size_t  gcd_dc_threshold             = MP_SIZE_T_MAX;
 mp_size_t  gcdext_dc_threshold          = MP_SIZE_T_MAX;
 mp_size_t  divrem_1_norm_threshold      = MP_SIZE_T_MAX;


More information about the gmp-commit mailing list