diff options
119 files changed, 218 insertions, 219 deletions
@@ -1,5 +1,7 @@ 2009-11-28 Torbjorn Granlund <tege@gmplib.org> + * Finish renaming BITS_PER_MP_LIMB to GMP_LIMB_BITS. + * macos: Remove entire directory. 2009-11-27 Torbjorn Granlund <tege@gmplib.org> diff --git a/Makefile.am b/Makefile.am index 270dd31f4..9de5f0d6b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -339,7 +339,7 @@ install-data-hook: EXTRA_DIST += dumbmp.c mpz/fac_ui.h: gen-fac_ui$(EXEEXT_FOR_BUILD) - ./gen-fac_ui $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpz/fac_ui.h || (rm -f mpz/fac_ui.h; exit 1) + ./gen-fac_ui $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpz/fac_ui.h || (rm -f mpz/fac_ui.h; exit 1) BUILT_SOURCES += mpz/fac_ui.h gen-fac_ui$(EXEEXT_FOR_BUILD): gen-fac_ui$(U_FOR_BUILD).c dumbmp.c @@ -352,11 +352,11 @@ gen-fac_ui_.c: gen-fac_ui.c $(ANSI2KNR) fib_table.h: gen-fib$(EXEEXT_FOR_BUILD) - ./gen-fib header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1) + ./gen-fib header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1) BUILT_SOURCES += fib_table.h mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD) - ./gen-fib table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1) + ./gen-fib table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1) BUILT_SOURCES += mpn/fib_table.c gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c dumbmp.c @@ -369,11 +369,11 @@ gen-fib_.c: gen-fib.c $(ANSI2KNR) mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD) - ./gen-bases header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1) + ./gen-bases header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1) BUILT_SOURCES += mp_bases.h mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD) - ./gen-bases table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1) + ./gen-bases table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1) BUILT_SOURCES += mpn/mp_bases.c gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c dumbmp.c @@ -387,7 +387,7 @@ gen-bases_.c: gen-bases.c $(ANSI2KNR) trialdivtab.h: gen-trialdivtab$(EXEEXT_FOR_BUILD) - ./gen-trialdivtab $(BITS_PER_MP_LIMB) 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1) + ./gen-trialdivtab $(GMP_LIMB_BITS) 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1) BUILT_SOURCES += trialdivtab.h gen-trialdivtab$(EXEEXT_FOR_BUILD): gen-trialdivtab$(U_FOR_BUILD).c dumbmp.c @@ -402,7 +402,7 @@ gen-trialdivtab_.c: gen-trialdivtab.c $(ANSI2KNR) mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD) - ./gen-psqr $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1) + ./gen-psqr $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1) BUILT_SOURCES += mpn/perfsqr.h gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c dumbmp.c diff --git a/acinclude.m4 b/acinclude.m4 index 55c9d3126..cfec43e14 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -112,13 +112,12 @@ dnl Expand to the right way to #include gmp-h.in. This must be used dnl instead of gmp.h, since that file isn't generated until the end of the dnl configure. dnl -dnl Dummy values for __GMP_BITS_PER_MP_LIMB and GMP_LIMB_BITS are enough +dnl Dummy values for GMP_LIMB_BITS and GMP_LIMB_BITS are enough dnl for all current configure-time uses of gmp.h. define(GMP_INCLUDE_GMP_H, [[#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */ #define GMP_NAIL_BITS $GMP_NAIL_BITS -#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */ #define GMP_LIMB_BITS 123 $DEFN_LONG_LONG_LIMB #include "$srcdir/gmp-h.in"] diff --git a/configure.in b/configure.in index 431685ced..b0f46930f 100644 --- a/configure.in +++ b/configure.in @@ -3178,7 +3178,7 @@ fi # Sizes of some types, needed at preprocessing time. # -# FIXME: The assumption that BITS_PER_MP_LIMB is 8*sizeof(mp_limb_t) might +# FIXME: The assumption that GMP_LIMB_BITS is 8*sizeof(mp_limb_t) might # be slightly rash, but it's true everywhere we know of and ought to be true # of any sensible system. In a generic C build, grepping LONG_BIT out of # <limits.h> might be an alternative, for maximum portability. @@ -3192,7 +3192,7 @@ AC_CHECK_SIZEOF(mp_limb_t, , GMP_INCLUDE_GMP_H) if test "$ac_cv_sizeof_mp_limb_t" = 0; then AC_MSG_ERROR([Oops, mp_limb_t doesn't seem to work]) fi -AC_SUBST(BITS_PER_MP_LIMB, `expr 8 \* $ac_cv_sizeof_mp_limb_t`) +AC_SUBST(GMP_LIMB_BITS, `expr 8 \* $ac_cv_sizeof_mp_limb_t`) GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"]) # Check compiler limb size matches gmp-mparam.h @@ -3202,20 +3202,20 @@ GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"]) # probably wouldn't want to be fatal, none of the libgmp assembler code # depends on ulong. # -mparam_bits=[`sed -n 's/^#define BITS_PER_MP_LIMB[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`] -if test -n "$mparam_bits" && test "$mparam_bits" -ne $BITS_PER_MP_LIMB; then +mparam_bits=[`sed -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`] +if test -n "$mparam_bits" && test "$mparam_bits" -ne $GMP_LIMB_BITS; then if test "$test_CFLAGS" = set; then - AC_MSG_ERROR([Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code + AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code in this configuration expects $mparam_bits bits. You appear to have set \$CFLAGS, perhaps you also need to tell GMP the intended ABI, see "ABI and ISA" in the manual.]) else - AC_MSG_ERROR([Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code + AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code in this configuration expects $mparam_bits bits.]) fi fi -GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$BITS_PER_MP_LIMB)"]) +GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$GMP_LIMB_BITS)"]) GMP_DEFINE_RAW(["define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)"]) GMP_DEFINE_RAW(["define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))"]) diff --git a/doc/tasks.html b/doc/tasks.html index 44c2d750e..f8fd6aaf6 100644 --- a/doc/tasks.html +++ b/doc/tasks.html @@ -37,7 +37,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. <hr> <!-- NB. timestamp updated automatically by emacs --> - This file current as of 15 Nov 2009. An up-to-date version is available at + This file current as of 28 Nov 2009. An up-to-date version is available at <a href="http://gmplib.org/tasks.html">http://gmplib.org/tasks.html</a>. Please send comments about this page to gmp-devel<font>@</font>gmplib.org. @@ -154,7 +154,7 @@ either already been taken care of, or have become irrelevant. <code>count_leading_zeros</code>, though it's possible an already normalized operand might not be encountered very often. <li> Rewrite <code>umul_ppmm</code> to use floating-point for generating the - most significant limb (if <code>BITS_PER_MP_LIMB</code> <= 52 bits). + most significant limb (if <code>GMP_LIMB_BITS</code> <= 52 bits). (Peter Montgomery has some ideas on this subject.) <li> Improve the default <code>umul_ppmm</code> code in longlong.h: Add partial products with fewer operations. @@ -28,10 +28,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* Instantiated by configure. */ #if ! defined (__GMP_WITHIN_CONFIGURE) -#define __GMP_BITS_PER_MP_LIMB @BITS_PER_MP_LIMB@ #define __GMP_HAVE_HOST_CPU_FAMILY_power @HAVE_HOST_CPU_FAMILY_power@ #define __GMP_HAVE_HOST_CPU_FAMILY_powerpc @HAVE_HOST_CPU_FAMILY_powerpc@ -#define GMP_LIMB_BITS @BITS_PER_MP_LIMB@ +#define GMP_LIMB_BITS @GMP_LIMB_BITS@ #define GMP_NAIL_BITS @GMP_NAIL_BITS@ #endif #define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS) diff --git a/gmp-impl.h b/gmp-impl.h index 22e479964..216ff5908 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -175,8 +175,8 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #ifndef BYTES_PER_MP_LIMB #define BYTES_PER_MP_LIMB SIZEOF_MP_LIMB_T #endif -#ifndef BITS_PER_MP_LIMB -#define BITS_PER_MP_LIMB (8 * SIZEOF_MP_LIMB_T) +#ifndef GMP_LIMB_BITS +#define GMP_LIMB_BITS (8 * SIZEOF_MP_LIMB_T) #endif #define BITS_PER_ULONG (8 * SIZEOF_UNSIGNED_LONG) @@ -2139,7 +2139,7 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, for the benefit of assertion checking. */ #if defined (__GNUC__) && HAVE_HOST_CPU_FAMILY_x86 && GMP_NAIL_BITS == 0 \ - && BITS_PER_MP_LIMB == 32 && ! defined (NO_ASM) && ! WANT_ASSERT + && GMP_LIMB_BITS == 32 && ! defined (NO_ASM) && ! WANT_ASSERT /* Better flags handling than the generic C gives on i386, saving a few bytes of code and maybe a cycle or two. */ @@ -2328,7 +2328,7 @@ struct bases i.e. the number of bits used to represent each digit in the base. */ mp_limb_t big_base; - /* A BITS_PER_MP_LIMB bit approximation to 1/big_base, represented as a + /* A GMP_LIMB_BITS bit approximation to 1/big_base, represented as a fixed-point number. Instead of dividing by big_base an application can choose to multiply by big_base_inverted. */ mp_limb_t big_base_inverted; @@ -2511,7 +2511,7 @@ __GMP_DECLSPEC mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CON #endif /* Divide the two-limb number in (NH,,NL) by D, with DI being the largest - limb not larger than (2**(2*BITS_PER_MP_LIMB))/D - (2**BITS_PER_MP_LIMB). + limb not larger than (2**(2*GMP_LIMB_BITS))/D - (2**GMP_LIMB_BITS). If this would yield overflow, DI should be the largest possible number (i.e., only ones). For correct operation, the most significant bit of D has to be set. Put the quotient in Q and the remainder in R. */ @@ -2568,8 +2568,8 @@ __GMP_DECLSPEC mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CON do { \ mp_limb_t _n2, _n10, _nmask, _nadj, _q1; \ mp_limb_t _xh, _xl; \ - _n2 = ((nh) << (BITS_PER_MP_LIMB - (lgup))) + ((nl) >> 1 >> (l - 1));\ - _n10 = (nl) << (BITS_PER_MP_LIMB - (lgup)); \ + _n2 = ((nh) << (GMP_LIMB_BITS - (lgup))) + ((nl) >> 1 >> (l - 1)); \ + _n10 = (nl) << (GMP_LIMB_BITS - (lgup)); \ _nmask = LIMB_HIGHBIT_TO_MASK (_n10); \ _nadj = _n10 + (_nmask & (dnorm)); \ umul_ppmm (_xh, _xl, di, _n2 - _nmask); \ @@ -2899,7 +2899,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; version 3.1 at least) doesn't seem to know how to generate rlwimi for anything other than bit-fields, so use "asm". */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && HAVE_HOST_CPU_FAMILY_powerpc && BITS_PER_MP_LIMB == 32 + && HAVE_HOST_CPU_FAMILY_powerpc && GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ mp_limb_t __bswapl_src = (src); \ @@ -2920,7 +2920,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; partial register stalls on P6 chips. */ #if defined (__GNUC__) && ! defined (NO_ASM) \ && HAVE_HOST_CPU_FAMILY_x86 && ! HAVE_HOST_CPU_i386 \ - && BITS_PER_MP_LIMB == 32 + && GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ __asm__ ("bswap %0" : "=r" (dst) : "0" (src)); \ @@ -2928,7 +2928,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; #endif #if defined (__GNUC__) && ! defined (NO_ASM) \ - && defined (__amd64__) && BITS_PER_MP_LIMB == 64 + && defined (__amd64__) && GMP_LIMB_BITS == 64 #define BSWAP_LIMB(dst, src) \ do { \ __asm__ ("bswap %q0" : "=r" (dst) : "0" (src)); \ @@ -2945,7 +2945,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* As per glibc. */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && HAVE_HOST_CPU_FAMILY_m68k && BITS_PER_MP_LIMB == 32 + && HAVE_HOST_CPU_FAMILY_m68k && GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ mp_limb_t __bswapl_src = (src); \ @@ -2958,17 +2958,17 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; #endif #if ! defined (BSWAP_LIMB) -#if BITS_PER_MP_LIMB == 8 +#if GMP_LIMB_BITS == 8 #define BSWAP_LIMB(dst, src) \ do { (dst) = (src); } while (0) #endif -#if BITS_PER_MP_LIMB == 16 +#if GMP_LIMB_BITS == 16 #define BSWAP_LIMB(dst, src) \ do { \ (dst) = ((src) << 8) + ((src) >> 8); \ } while (0) #endif -#if BITS_PER_MP_LIMB == 32 +#if GMP_LIMB_BITS == 32 #define BSWAP_LIMB(dst, src) \ do { \ (dst) = \ @@ -2978,7 +2978,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; + ((src) >> 24); \ } while (0) #endif -#if BITS_PER_MP_LIMB == 64 +#if GMP_LIMB_BITS == 64 #define BSWAP_LIMB(dst, src) \ do { \ (dst) = \ @@ -3013,7 +3013,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* Apparently lwbrx might be slow on some PowerPC chips, so restrict it to those we know are fast. */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && BITS_PER_MP_LIMB == 32 && HAVE_LIMB_BIG_ENDIAN \ + && GMP_LIMB_BITS == 32 && HAVE_LIMB_BIG_ENDIAN \ && (HAVE_HOST_CPU_powerpc604 \ || HAVE_HOST_CPU_powerpc604e \ || HAVE_HOST_CPU_powerpc750 \ @@ -3038,7 +3038,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* On the same basis that lwbrx might be slow, restrict stwbrx to those we know are fast. FIXME: Is this necessary? */ #if defined (__GNUC__) && ! defined (NO_ASM) \ - && BITS_PER_MP_LIMB == 32 && HAVE_LIMB_BIG_ENDIAN \ + && GMP_LIMB_BITS == 32 && HAVE_LIMB_BIG_ENDIAN \ && (HAVE_HOST_CPU_powerpc604 \ || HAVE_HOST_CPU_powerpc604e \ || HAVE_HOST_CPU_powerpc750 \ @@ -3099,7 +3099,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128]; /* No processor claiming to be SPARC v9 compliant seems to implement the POPC instruction. Disable pattern for now. */ #if 0 -#if defined __GNUC__ && defined __sparc_v9__ && BITS_PER_MP_LIMB == 64 +#if defined __GNUC__ && defined __sparc_v9__ && GMP_LIMB_BITS == 64 #define popc_limb(result, input) \ do { \ DItype __res; \ @@ -3213,7 +3213,7 @@ typedef unsigned long int UDItype; typedef mp_limb_t UWtype; typedef unsigned int UHWtype; -#define W_TYPE_SIZE BITS_PER_MP_LIMB +#define W_TYPE_SIZE GMP_LIMB_BITS /* Define ieee_double_extract and _GMP_IEEE_FLOATS. @@ -3712,7 +3712,7 @@ __GMP_DECLSPEC extern mp_size_t __gmp_default_fp_limb_precision; further +1 is because the limbs usually won't fall on digit boundaries. FIXME: If base is a power of 2 and the bits per digit divides - BITS_PER_MP_LIMB then the +2 is unnecessary. This happens always for + GMP_LIMB_BITS then the +2 is unnecessary. This happens always for base==2, and in base==16 with the current 32 or 64 bit limb sizes. */ #define MPF_SIGNIFICANT_DIGITS(n, base, prec) \ @@ -19,6 +19,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include "gmp.h" #include "gmp-impl.h" -const int mp_bits_per_limb = BITS_PER_MP_LIMB; +const int mp_bits_per_limb = GMP_LIMB_BITS; const int __gmp_0 = 0; int __gmp_junk; diff --git a/mpn/alpha/ev5/gmp-mparam.h b/mpn/alpha/ev5/gmp-mparam.h index 93938e14d..8a40f2720 100644 --- a/mpn/alpha/ev5/gmp-mparam.h +++ b/mpn/alpha/ev5/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/alpha/ev6/gmp-mparam.h b/mpn/alpha/ev6/gmp-mparam.h index 9bb3880ca..b330793e6 100644 --- a/mpn/alpha/ev6/gmp-mparam.h +++ b/mpn/alpha/ev6/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 #define DIVEXACT_BY3_METHOD 0 /* override ../diveby3.asm */ diff --git a/mpn/alpha/ev6/nails/gmp-mparam.h b/mpn/alpha/ev6/nails/gmp-mparam.h index 75777880d..9911ea214 100644 --- a/mpn/alpha/ev6/nails/gmp-mparam.h +++ b/mpn/alpha/ev6/nails/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* Generated by tuneup.c, 2004-02-07, gcc 3.3 */ diff --git a/mpn/alpha/gmp-mparam.h b/mpn/alpha/gmp-mparam.h index fc63edabf..1ae5192ea 100644 --- a/mpn/alpha/gmp-mparam.h +++ b/mpn/alpha/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/arm/gmp-mparam.h b/mpn/arm/gmp-mparam.h index 35055da32..8e08a3dea 100644 --- a/mpn/arm/gmp-mparam.h +++ b/mpn/arm/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* 593MHz ARM (gcc50.fsffrance.org) */ diff --git a/mpn/cray/gmp-mparam.h b/mpn/cray/gmp-mparam.h index e2aecdb6f..3ff8f5e16 100644 --- a/mpn/cray/gmp-mparam.h +++ b/mpn/cray/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 #if 0 diff --git a/mpn/cray/ieee/gmp-mparam.h b/mpn/cray/ieee/gmp-mparam.h index e86b6db64..3442c11fe 100644 --- a/mpn/cray/ieee/gmp-mparam.h +++ b/mpn/cray/ieee/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* Generated by tuneup.c, 2004-02-07, system compiler */ diff --git a/mpn/cray/ieee/invert_limb.c b/mpn/cray/ieee/invert_limb.c index e3484a915..220cc25f0 100644 --- a/mpn/cray/ieee/invert_limb.c +++ b/mpn/cray/ieee/invert_limb.c @@ -73,14 +73,14 @@ mpn_invert_limb (mp_limb_t d) mp_limb_t xh, xl; mp_limb_t zh, zl; -#if BITS_PER_MP_LIMB == 32 +#if GMP_LIMB_BITS == 32 z = approx_tab[(d >> 23) - 0x100] << 6; /* z < 2^16 */ z2l = z * z; /* z2l < 2^32 */ umul_ppmm (th, tl, z2l, d); z = (z << 17) - (th << 1); #endif -#if BITS_PER_MP_LIMB == 64 +#if GMP_LIMB_BITS == 64 z = approx_tab[(d >> 55) - 0x100] << 6; /* z < 2^16 */ z2l = z * z; /* z2l < 2^32 */ @@ -97,7 +97,7 @@ mpn_invert_limb (mp_limb_t d) umul_ppmm (xh, xl, z2l, d); tl += xh; th += tl < xh; - th = (th << 2) | (tl >> BITS_PER_MP_LIMB - 2); + th = (th << 2) | (tl >> GMP_LIMB_BITS - 2); tl = tl << 2; sub_ddmmss (zh, zl, z << 2, 0, th, tl); diff --git a/mpn/cray/lshift.c b/mpn/cray/lshift.c index 64302e9d3..482747254 100644 --- a/mpn/cray/lshift.c +++ b/mpn/cray/lshift.c @@ -29,7 +29,7 @@ mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t n, unsigned int cnt) mp_limb_t retval; sh_1 = cnt; - sh_2 = BITS_PER_MP_LIMB - sh_1; + sh_2 = GMP_LIMB_BITS - sh_1; retval = up[n - 1] >> sh_2; #pragma _CRI ivdep diff --git a/mpn/cray/rshift.c b/mpn/cray/rshift.c index 6280d2ca7..3630b628d 100644 --- a/mpn/cray/rshift.c +++ b/mpn/cray/rshift.c @@ -29,7 +29,7 @@ mpn_rshift (mp_ptr wp, mp_srcptr up, mp_size_t n, unsigned int cnt) mp_limb_t retval; sh_1 = cnt; - sh_2 = BITS_PER_MP_LIMB - sh_1; + sh_2 = GMP_LIMB_BITS - sh_1; retval = up[0] << sh_2; #pragma _CRI ivdep diff --git a/mpn/generic/bdivmod.c b/mpn/generic/bdivmod.c index a7bff1bbd..bc8cd34a0 100644 --- a/mpn/generic/bdivmod.c +++ b/mpn/generic/bdivmod.c @@ -20,16 +20,16 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* q_high = mpn_bdivmod (qp, up, usize, vp, vsize, d). - Puts the low d/BITS_PER_MP_LIMB limbs of Q = U / V mod 2^d at qp, and - returns the high d%BITS_PER_MP_LIMB bits of Q as the result. + Puts the low d/GMP_LIMB_BITS limbs of Q = U / V mod 2^d at qp, and + returns the high d%GMP_LIMB_BITS bits of Q as the result. - Also, U - Q * V mod 2^(usize*BITS_PER_MP_LIMB) is placed at up. Since the - low d/BITS_PER_MP_LIMB limbs of this difference are zero, the code allows + Also, U - Q * V mod 2^(usize*GMP_LIMB_BITS) is placed at up. Since the + low d/GMP_LIMB_BITS limbs of this difference are zero, the code allows the limb vectors at qp to overwrite the low limbs at up, provided qp <= up. Preconditions: 1. V is odd. - 2. usize * BITS_PER_MP_LIMB >= d. + 2. usize * GMP_LIMB_BITS >= d. 3. If Q and U overlap, qp <= up. Ken Weber (kweber@mat.ufrgs.br, kweber@mcs.kent.edu) diff --git a/mpn/generic/dive_1.c b/mpn/generic/dive_1.c index 27df57b80..f246b091c 100644 --- a/mpn/generic/dive_1.c +++ b/mpn/generic/dive_1.c @@ -30,7 +30,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* Divide a={src,size} by d=divisor and store the quotient in q={dst,size}. q will only be correct if d divides a exactly. - A separate loop is used for shift==0 because n<<BITS_PER_MP_LIMB doesn't + A separate loop is used for shift==0 because n<<GMP_LIMB_BITS doesn't give zero on all CPUs (for instance it doesn't on the x86s). This separate loop might run faster too, helping odd divisors. @@ -50,7 +50,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ faster on some CPUs and would mean just the shift==0 style loop would be needed. - If n<<BITS_PER_MP_LIMB gives zero on a particular CPU then the separate + If n<<GMP_LIMB_BITS gives zero on a particular CPU then the separate shift==0 loop is unnecessary, and could be eliminated if there's no great speed difference. diff --git a/mpn/generic/gmp-mparam.h b/mpn/generic/gmp-mparam.h index b22b96ef6..aab5fa510 100644 --- a/mpn/generic/gmp-mparam.h +++ b/mpn/generic/gmp-mparam.h @@ -18,5 +18,5 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* Values for BITS_PER_MP_LIMB etc will be determined by ./configure and put +/* Values for GMP_LIMB_BITS etc will be determined by ./configure and put in config.h. */ diff --git a/mpn/generic/mode1o.c b/mpn/generic/mode1o.c index 064becdad..e8978a4c5 100644 --- a/mpn/generic/mode1o.c +++ b/mpn/generic/mode1o.c @@ -30,7 +30,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ r*B^k + a - c == q*d - where B=2^BITS_PER_MP_LIMB, a is {src,size}, k is either size or size-1 + where B=2^GMP_LIMB_BITS, a is {src,size}, k is either size or size-1 (the caller won't know which), and q is the quotient (discarded). d must be odd, c can be any limb value. diff --git a/mpn/generic/pre_divrem_1.c b/mpn/generic/pre_divrem_1.c index c5a028894..134b4cb44 100644 --- a/mpn/generic/pre_divrem_1.c +++ b/mpn/generic/pre_divrem_1.c @@ -32,7 +32,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* Same test here for skipping one divide step as in mpn_divrem_1. The main reason for a separate shift==0 case is that not all CPUs give - zero for "n0 >> BITS_PER_MP_LIMB" which would arise in the general case + zero for "n0 >> GMP_LIMB_BITS" which would arise in the general case code used on shift==0. shift==0 is also reasonably common in mp_bases big_base, for instance base==10 on a 64-bit limb. @@ -106,14 +106,14 @@ mpn_preinv_divrem_1 (mp_ptr qp, mp_size_t xsize, } n1 = ap[size-1]; - r |= n1 >> (BITS_PER_MP_LIMB - shift); + r |= n1 >> (GMP_LIMB_BITS - shift); for (i = size-2; i >= 0; i--) { ASSERT (r < d); n0 = ap[i]; udiv_qrnnd_preinv (*qp, r, r, - ((n1 << shift) | (n0 >> (BITS_PER_MP_LIMB - shift))), + ((n1 << shift) | (n0 >> (GMP_LIMB_BITS - shift))), d, dinv); qp--; n1 = n0; diff --git a/mpn/generic/sizeinbase.c b/mpn/generic/sizeinbase.c index cfa57ea35..303359a5c 100644 --- a/mpn/generic/sizeinbase.c +++ b/mpn/generic/sizeinbase.c @@ -45,7 +45,7 @@ mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base) /* Calculate the total number of significant bits of X. */ count_leading_zeros (cnt, xp[xsize-1]); - totbits = xsize * BITS_PER_MP_LIMB - cnt; + totbits = xsize * GMP_LIMB_BITS - cnt; if (POW2_P (base)) { diff --git a/mpn/generic/tdiv_qr.c b/mpn/generic/tdiv_qr.c index 59d04c424..ceee8f70d 100644 --- a/mpn/generic/tdiv_qr.c +++ b/mpn/generic/tdiv_qr.c @@ -280,7 +280,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn, dl = dp[in - 2]; #if GMP_NAIL_BITS == 0 - x = (dp[in - 1] << cnt) | ((dl >> 1) >> ((~cnt) % BITS_PER_MP_LIMB)); + x = (dp[in - 1] << cnt) | ((dl >> 1) >> ((~cnt) % GMP_LIMB_BITS)); #else x = (dp[in - 1] << cnt) & GMP_NUMB_MASK; if (cnt != 0) diff --git a/mpn/generic/udiv_w_sdiv.c b/mpn/generic/udiv_w_sdiv.c index f876aa573..c01f95847 100644 --- a/mpn/generic/udiv_w_sdiv.c +++ b/mpn/generic/udiv_w_sdiv.c @@ -42,7 +42,7 @@ mpn_udiv_w_sdiv (rp, a1, a0, d) if ((mp_limb_signed_t) d >= 0) { - if (a1 < d - a1 - (a0 >> (BITS_PER_MP_LIMB - 1))) + if (a1 < d - a1 - (a0 >> (GMP_LIMB_BITS - 1))) { /* dividend, divisor, and quotient are nonnegative */ sdiv_qrnnd (q, r, a1, a0, d); @@ -50,18 +50,18 @@ mpn_udiv_w_sdiv (rp, a1, a0, d) else { /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */ - sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (BITS_PER_MP_LIMB - 1)); + sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (GMP_LIMB_BITS - 1)); /* Divide (c1*2^32 + c0) by d */ sdiv_qrnnd (q, r, c1, c0, d); /* Add 2^31 to quotient */ - q += (mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1); + q += (mp_limb_t) 1 << (GMP_LIMB_BITS - 1); } } else { b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */ c1 = a1 >> 1; /* A/2 */ - c0 = (a1 << (BITS_PER_MP_LIMB - 1)) + (a0 >> 1); + c0 = (a1 << (GMP_LIMB_BITS - 1)) + (a0 >> 1); if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */ { diff --git a/mpn/ia64/gmp-mparam.h b/mpn/ia64/gmp-mparam.h index a889b6693..5f929b8f8 100644 --- a/mpn/ia64/gmp-mparam.h +++ b/mpn/ia64/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 1300MHz Itanium2 (babe.fsffrance.org) */ diff --git a/mpn/m68k/gmp-mparam.h b/mpn/m68k/gmp-mparam.h index f682cdfef..21b817ed4 100644 --- a/mpn/m68k/gmp-mparam.h +++ b/mpn/m68k/gmp-mparam.h @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/mips32/gmp-mparam.h b/mpn/mips32/gmp-mparam.h index 2c605160d..a8f27326c 100644 --- a/mpn/mips32/gmp-mparam.h +++ b/mpn/mips32/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/mips64/gmp-mparam.h b/mpn/mips64/gmp-mparam.h index 0781da835..2bf942431 100644 --- a/mpn/mips64/gmp-mparam.h +++ b/mpn/mips64/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/pa32/gmp-mparam.h b/mpn/pa32/gmp-mparam.h index c41214da2..ca5ead0e3 100644 --- a/mpn/pa32/gmp-mparam.h +++ b/mpn/pa32/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* These values are for the PA7100 using GCC. */ diff --git a/mpn/pa32/hppa1_1/gmp-mparam.h b/mpn/pa32/hppa1_1/gmp-mparam.h index 57d6fefb1..32b3ae9d6 100644 --- a/mpn/pa32/hppa1_1/gmp-mparam.h +++ b/mpn/pa32/hppa1_1/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* Generated by tuneup.c, 2004-02-07, gcc 2.8 (pa7100/100MHz) */ diff --git a/mpn/pa32/hppa2_0/gmp-mparam.h b/mpn/pa32/hppa2_0/gmp-mparam.h index c19a113d9..1cfd70b1d 100644 --- a/mpn/pa32/hppa2_0/gmp-mparam.h +++ b/mpn/pa32/hppa2_0/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* Generated by tuneup.c, 2009-03-05, gcc 4.3 */ diff --git a/mpn/pa64/gmp-mparam.h b/mpn/pa64/gmp-mparam.h index 527c9648b..e8e11f32c 100644 --- a/mpn/pa64/gmp-mparam.h +++ b/mpn/pa64/gmp-mparam.h @@ -18,7 +18,7 @@ for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 440MHz PA8200 */ diff --git a/mpn/powerpc32/750/gmp-mparam.h b/mpn/powerpc32/750/gmp-mparam.h index c443729d4..23a0a0500 100644 --- a/mpn/powerpc32/750/gmp-mparam.h +++ b/mpn/powerpc32/750/gmp-mparam.h @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/powerpc32/gmp-mparam.h b/mpn/powerpc32/gmp-mparam.h index e6de1649c..a0e40edad 100644 --- a/mpn/powerpc32/gmp-mparam.h +++ b/mpn/powerpc32/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/powerpc64/gmp-mparam.h b/mpn/powerpc64/gmp-mparam.h index b2f853bbc..cd4a5de3d 100644 --- a/mpn/powerpc64/gmp-mparam.h +++ b/mpn/powerpc64/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/powerpc64/mode64/gmp-mparam.h b/mpn/powerpc64/mode64/gmp-mparam.h index 91bdec45a..58eead316 100644 --- a/mpn/powerpc64/mode64/gmp-mparam.h +++ b/mpn/powerpc64/mode64/gmp-mparam.h @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 1600MHz PPC970 */ diff --git a/mpn/powerpc64/mode64/p3/gmp-mparam.h b/mpn/powerpc64/mode64/p3/gmp-mparam.h index 2f0984093..c707eb782 100644 --- a/mpn/powerpc64/mode64/p3/gmp-mparam.h +++ b/mpn/powerpc64/mode64/p3/gmp-mparam.h @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/powerpc64/mode64/p4/gmp-mparam.h b/mpn/powerpc64/mode64/p4/gmp-mparam.h index 3acf6905d..17994f786 100644 --- a/mpn/powerpc64/mode64/p4/gmp-mparam.h +++ b/mpn/powerpc64/mode64/p4/gmp-mparam.h @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/powerpc64/mode64/p5/gmp-mparam.h b/mpn/powerpc64/mode64/p5/gmp-mparam.h index f8f9d5bd3..e5c7a8b14 100644 --- a/mpn/powerpc64/mode64/p5/gmp-mparam.h +++ b/mpn/powerpc64/mode64/p5/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* POWER5 (friggms.hpc.ntnu.no) */ diff --git a/mpn/s390/gmp-mparam.h b/mpn/s390/gmp-mparam.h index a2e31156d..bbcfbd6a4 100644 --- a/mpn/s390/gmp-mparam.h +++ b/mpn/s390/gmp-mparam.h @@ -18,7 +18,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -/* BITS_PER_MP_LIMB etc generated by configure */ +/* GMP_LIMB_BITS etc generated by configure */ /* Generated by tuneup.c, 2001-12-03, gcc 2.95 */ diff --git a/mpn/sparc32/v8/gmp-mparam.h b/mpn/sparc32/v8/gmp-mparam.h index bb5cd4766..0962732b5 100644 --- a/mpn/sparc32/v8/gmp-mparam.h +++ b/mpn/sparc32/v8/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* Generated by tuneup.c, 2004-02-07, gcc 2.95 */ diff --git a/mpn/sparc32/v8/supersparc/gmp-mparam.h b/mpn/sparc32/v8/supersparc/gmp-mparam.h index c01722710..130e9a539 100644 --- a/mpn/sparc32/v8/supersparc/gmp-mparam.h +++ b/mpn/sparc32/v8/supersparc/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* Generated by tuneup.c, 2004-02-10, gcc 3.3 */ diff --git a/mpn/sparc32/v9/gmp-mparam.h b/mpn/sparc32/v9/gmp-mparam.h index 65e45e0dd..2add06892 100644 --- a/mpn/sparc32/v9/gmp-mparam.h +++ b/mpn/sparc32/v9/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 /* Generated by tuneup.c, 2009-02-12, gcc 2.95 */ diff --git a/mpn/sparc64/gmp-mparam.h b/mpn/sparc64/gmp-mparam.h index b91e1a902..88f387240 100644 --- a/mpn/sparc64/gmp-mparam.h +++ b/mpn/sparc64/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* Generated by tuneup.c, 2009-01-15, gcc 3.4 */ diff --git a/mpn/x86/dive_1.asm b/mpn/x86/dive_1.asm index d2d02f9f7..cb927e5d9 100644 --- a/mpn/x86/dive_1.asm +++ b/mpn/x86/dive_1.asm @@ -97,7 +97,7 @@ ifdef(`PIC',` subl %edx, %eax C inv = 2*inv - inv*inv*d - ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() imull PARAM_DIVISOR, %eax cmpl $1, %eax diff --git a/mpn/x86/fat/gmp-mparam.h b/mpn/x86/fat/gmp-mparam.h index 83c3716cd..051a87d19 100644 --- a/mpn/x86/fat/gmp-mparam.h +++ b/mpn/x86/fat/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/gmp-mparam.h b/mpn/x86/gmp-mparam.h index 22ee86f7e..4f91bd230 100644 --- a/mpn/x86/gmp-mparam.h +++ b/mpn/x86/gmp-mparam.h @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/i486/gmp-mparam.h b/mpn/x86/i486/gmp-mparam.h index a9c592c7c..30084ed67 100644 --- a/mpn/x86/i486/gmp-mparam.h +++ b/mpn/x86/i486/gmp-mparam.h @@ -17,7 +17,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/k6/gmp-mparam.h b/mpn/x86/k6/gmp-mparam.h index f2b003f0f..0029ba6f4 100644 --- a/mpn/x86/k6/gmp-mparam.h +++ b/mpn/x86/k6/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/k6/mmx/dive_1.asm b/mpn/x86/k6/mmx/dive_1.asm index 9cc90d88a..f169bfc14 100644 --- a/mpn/x86/k6/mmx/dive_1.asm +++ b/mpn/x86/k6/mmx/dive_1.asm @@ -117,7 +117,7 @@ Zdisp( movzbl, 0,(%eax,%ebp), %eax) subl %ebp, %eax C inv = 2*inv - inv*inv*d subl $1, %edx C shift amount, and clear carry - ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() imull PARAM_DIVISOR, %eax cmpl $1, %eax diff --git a/mpn/x86/k6/mode1o.asm b/mpn/x86/k6/mode1o.asm index f29987791..34f35369f 100644 --- a/mpn/x86/k6/mode1o.asm +++ b/mpn/x86/k6/mode1o.asm @@ -103,7 +103,7 @@ Zdisp( movzbl, 0,(%ecx,%edi), %edi) C inv 8 bits subl %ecx, %edi C inv = 2*inv - inv*inv*d - ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax movl %esi, %eax imull %edi, %eax diff --git a/mpn/x86/k7/dive_1.asm b/mpn/x86/k7/dive_1.asm index c994e0fb0..a754d0916 100644 --- a/mpn/x86/k7/dive_1.asm +++ b/mpn/x86/k7/dive_1.asm @@ -105,7 +105,7 @@ ifdef(`PIC',` subl %edx, %eax C inv = 2*inv - inv*inv*d - ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() imull PARAM_DIVISOR, %eax cmpl $1, %eax diff --git a/mpn/x86/k7/gmp-mparam.h b/mpn/x86/k7/gmp-mparam.h index 910cebcdc..fc65b1f82 100644 --- a/mpn/x86/k7/gmp-mparam.h +++ b/mpn/x86/k7/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/k7/mode1o.asm b/mpn/x86/k7/mode1o.asm index ef858049a..f2eaf22cb 100644 --- a/mpn/x86/k7/mode1o.asm +++ b/mpn/x86/k7/mode1o.asm @@ -111,7 +111,7 @@ ifdef(`PIC',` subl %eax, %edi C inv = 2*inv - inv*inv*d - ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS movl %esi, %eax imull %edi, %eax cmpl $1, %eax') diff --git a/mpn/x86/p6/dive_1.asm b/mpn/x86/p6/dive_1.asm index e8efc28ea..23d1d53af 100644 --- a/mpn/x86/p6/dive_1.asm +++ b/mpn/x86/p6/dive_1.asm @@ -106,7 +106,7 @@ ifdef(`PIC',` subl %eax, %ebp C inv = 2*inv - inv*inv*d - ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS movl PARAM_DIVISOR, %eax imull %ebp, %eax cmpl $1, %eax') diff --git a/mpn/x86/p6/gmp-mparam.h b/mpn/x86/p6/gmp-mparam.h index 9c4207617..a84b018ee 100644 --- a/mpn/x86/p6/gmp-mparam.h +++ b/mpn/x86/p6/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/p6/mmx/gmp-mparam.h b/mpn/x86/p6/mmx/gmp-mparam.h index f57ef0cea..10f22adf9 100644 --- a/mpn/x86/p6/mmx/gmp-mparam.h +++ b/mpn/x86/p6/mmx/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/p6/mode1o.asm b/mpn/x86/p6/mode1o.asm index 4aff48d7e..7361164cd 100644 --- a/mpn/x86/p6/mode1o.asm +++ b/mpn/x86/p6/mode1o.asm @@ -101,7 +101,7 @@ ifdef(`PIC',` subl %eax, %edi C inv = 2*inv - inv*inv*d - ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS movl PARAM_DIVISOR, %eax imull %edi, %eax cmpl $1, %eax') diff --git a/mpn/x86/p6/sse2/gmp-mparam.h b/mpn/x86/p6/sse2/gmp-mparam.h index 31ddfb705..6c2856550 100644 --- a/mpn/x86/p6/sse2/gmp-mparam.h +++ b/mpn/x86/p6/sse2/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/pentium/dive_1.asm b/mpn/x86/pentium/dive_1.asm index 79885244a..253d1283d 100644 --- a/mpn/x86/pentium/dive_1.asm +++ b/mpn/x86/pentium/dive_1.asm @@ -146,7 +146,7 @@ dnl non-PIC negl %ebx C -size - ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() imull PARAM_DIVISOR, %eax cmpl $1, %eax diff --git a/mpn/x86/pentium/gmp-mparam.h b/mpn/x86/pentium/gmp-mparam.h index cf8328ad1..de293c4a2 100644 --- a/mpn/x86/pentium/gmp-mparam.h +++ b/mpn/x86/pentium/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/pentium/mmx/gmp-mparam.h b/mpn/x86/pentium/mmx/gmp-mparam.h index 21819d20b..d9d4eaad7 100644 --- a/mpn/x86/pentium/mmx/gmp-mparam.h +++ b/mpn/x86/pentium/mmx/gmp-mparam.h @@ -19,7 +19,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/pentium/mode1o.asm b/mpn/x86/pentium/mode1o.asm index 222f64e5c..afb0ebe5b 100644 --- a/mpn/x86/pentium/mode1o.asm +++ b/mpn/x86/pentium/mode1o.asm @@ -122,7 +122,7 @@ dnl non-PIC subl %eax, %ecx C inv = 2*inv - inv*inv*d pushl %esi FRAME_pushl() - ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS movl %ecx, %eax imull PARAM_DIVISOR, %eax cmpl $1, %eax') diff --git a/mpn/x86/pentium4/sse2/dive_1.asm b/mpn/x86/pentium4/sse2/dive_1.asm index c50ef7d29..5e0e38e53 100644 --- a/mpn/x86/pentium4/sse2/dive_1.asm +++ b/mpn/x86/pentium4/sse2/dive_1.asm @@ -126,7 +126,7 @@ ifdef(`PIC',` psubd %mm0, %mm5 C inv = 2*inv - inv*inv*d - ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() movq %mm6, %mm0 pmuludq %mm5, %mm0 diff --git a/mpn/x86/pentium4/sse2/gmp-mparam.h b/mpn/x86/pentium4/sse2/gmp-mparam.h index f26adf271..da9ace622 100644 --- a/mpn/x86/pentium4/sse2/gmp-mparam.h +++ b/mpn/x86/pentium4/sse2/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 32 +#define GMP_LIMB_BITS 32 #define BYTES_PER_MP_LIMB 4 diff --git a/mpn/x86/pentium4/sse2/mode1o.asm b/mpn/x86/pentium4/sse2/mode1o.asm index 2f0b177a0..f9d1f1496 100644 --- a/mpn/x86/pentium4/sse2/mode1o.asm +++ b/mpn/x86/pentium4/sse2/mode1o.asm @@ -101,7 +101,7 @@ ifdef(`PIC',` psubd %mm0, %mm6 C inv = 2*inv - inv*inv*d - ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB + ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() movd %mm6, %eax imul PARAM_DIVISOR, %eax diff --git a/mpn/x86_64/atom/gmp-mparam.h b/mpn/x86_64/atom/gmp-mparam.h index 917b1cece..9ec43c742 100644 --- a/mpn/x86_64/atom/gmp-mparam.h +++ b/mpn/x86_64/atom/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* Generated by tuneup.c, 2009-11-26, gcc 4.4 */ diff --git a/mpn/x86_64/core2/gmp-mparam.h b/mpn/x86_64/core2/gmp-mparam.h index e9f8d0eb0..7ec4783e2 100644 --- a/mpn/x86_64/core2/gmp-mparam.h +++ b/mpn/x86_64/core2/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 2133 MHz Core 2 (65nm) */ diff --git a/mpn/x86_64/corei/gmp-mparam.h b/mpn/x86_64/corei/gmp-mparam.h index 00c2aec05..8e60f94de 100644 --- a/mpn/x86_64/corei/gmp-mparam.h +++ b/mpn/x86_64/corei/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 2667 MHz Core i7 */ diff --git a/mpn/x86_64/fat/gmp-mparam.h b/mpn/x86_64/fat/gmp-mparam.h index 17591e415..7e71f715b 100644 --- a/mpn/x86_64/fat/gmp-mparam.h +++ b/mpn/x86_64/fat/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 diff --git a/mpn/x86_64/gmp-mparam.h b/mpn/x86_64/gmp-mparam.h index 76f345197..8d43a2403 100644 --- a/mpn/x86_64/gmp-mparam.h +++ b/mpn/x86_64/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 2500 MHz Athlon64 / 512 Kibyte cache */ diff --git a/mpn/x86_64/nano/gmp-mparam.h b/mpn/x86_64/nano/gmp-mparam.h index b20015a64..374999649 100644 --- a/mpn/x86_64/nano/gmp-mparam.h +++ b/mpn/x86_64/nano/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* 1600 MHz Nano 2xxx */ diff --git a/mpn/x86_64/pentium4/gmp-mparam.h b/mpn/x86_64/pentium4/gmp-mparam.h index 56beb00bc..26fa78e36 100644 --- a/mpn/x86_64/pentium4/gmp-mparam.h +++ b/mpn/x86_64/pentium4/gmp-mparam.h @@ -18,7 +18,7 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 64 +#define GMP_LIMB_BITS 64 #define BYTES_PER_MP_LIMB 8 /* These routines exists for all x86_64 chips, but they are slower on Pentium4 diff --git a/mpn/z8000/gmp-mparam.h b/mpn/z8000/gmp-mparam.h index f42e380a7..1b25c9b47 100644 --- a/mpn/z8000/gmp-mparam.h +++ b/mpn/z8000/gmp-mparam.h @@ -17,5 +17,5 @@ License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ -#define BITS_PER_MP_LIMB 16 +#define GMP_LIMB_BITS 16 #define BYTES_PER_MP_LIMB 2 diff --git a/mpq/get_str.c b/mpq/get_str.c index 4079a933b..68ca34f6f 100644 --- a/mpq/get_str.c +++ b/mpq/get_str.c @@ -37,7 +37,7 @@ mpq_get_str (char *str, int base, mpq_srcptr q) the high limbs of num and den are used. +2 for rounding up the chars per bit of num and den. +3 for sign, slash and '\0'. */ str_alloc = ((size_t) ((ABS (q->_mp_num._mp_size) + q->_mp_den._mp_size) - * BITS_PER_MP_LIMB + * GMP_LIMB_BITS * mp_bases[ABS(base)].chars_per_bit_exactly)) + 5; str = (char *) (*__gmp_allocate_func) (str_alloc); diff --git a/mpz/aorsmul_i.c b/mpz/aorsmul_i.c index c23495c40..1bc6f4768 100644 --- a/mpz/aorsmul_i.c +++ b/mpz/aorsmul_i.c @@ -53,7 +53,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ a chance of being faster since it involves only one set of carry propagations, not two. Note that doing an addmul_1 with a twos-complement negative y doesn't work, because it effectively adds an - extra x * 2^BITS_PER_MP_LIMB. */ + extra x * 2^GMP_LIMB_BITS. */ REGPARM_ATTR(1) void mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub) @@ -135,7 +135,7 @@ gcd (mpz_srcptr u, mpz_srcptr v, mpz_ptr g) ? mpn_gcd (vp, vp, vsize, up, usize) : mpn_gcd (vp, up, usize, vp, vsize); - /* Here G <-- V << (g_zero_limbs*BITS_PER_MP_LIMB + g_zero_bits). */ + /* Here G <-- V << (g_zero_limbs*GMP_LIMB_BITS + g_zero_bits). */ gsize = vsize + g_zero_limbs; if (g_zero_bits != 0) { diff --git a/mpz/out_str.c b/mpz/out_str.c index fbb7624fc..29da7e9bf 100644 --- a/mpz/out_str.c +++ b/mpz/out_str.c @@ -71,7 +71,7 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x) } TMP_MARK; - str_size = ((size_t) (x_size * BITS_PER_MP_LIMB + str_size = ((size_t) (x_size * GMP_LIMB_BITS * mp_bases[base].chars_per_bit_exactly)) + 3; str = (unsigned char *) TMP_ALLOC (str_size); diff --git a/mpz/powm_ui.c b/mpz/powm_ui.c index 9e44301d2..6200f3333 100644 --- a/mpz/powm_ui.c +++ b/mpz/powm_ui.c @@ -109,7 +109,7 @@ mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m) e = el; count_leading_zeros (c, e); e = (e << c) << 1; /* shift the exp bits to the left, lose msb */ - c = BITS_PER_MP_LIMB - 1 - c; + c = GMP_LIMB_BITS - 1 - c; /* Main loop. */ diff --git a/mpz/pprime_p.c b/mpz/pprime_p.c index 766155fa8..ce501a44b 100644 --- a/mpz/pprime_p.c +++ b/mpz/pprime_p.c @@ -70,19 +70,19 @@ mpz_probab_prime_p (mpz_srcptr n, int reps) r = mpn_mod_1 (PTR(n), (mp_size_t) SIZ(n), (mp_limb_t) PP); #endif if (r % 3 == 0 -#if BITS_PER_MP_LIMB >= 4 +#if GMP_LIMB_BITS >= 4 || r % 5 == 0 #endif -#if BITS_PER_MP_LIMB >= 8 +#if GMP_LIMB_BITS >= 8 || r % 7 == 0 #endif -#if BITS_PER_MP_LIMB >= 16 +#if GMP_LIMB_BITS >= 16 || r % 11 == 0 || r % 13 == 0 #endif -#if BITS_PER_MP_LIMB >= 32 +#if GMP_LIMB_BITS >= 32 || r % 17 == 0 || r % 19 == 0 || r % 23 == 0 || r % 29 == 0 #endif -#if BITS_PER_MP_LIMB >= 64 +#if GMP_LIMB_BITS >= 64 || r % 31 == 0 || r % 37 == 0 || r % 41 == 0 || r % 43 == 0 || r % 47 == 0 || r % 53 == 0 #endif diff --git a/printf/doprntf.c b/printf/doprntf.c index db7fd2e59..537dce5b6 100644 --- a/printf/doprntf.c +++ b/printf/doprntf.c @@ -62,7 +62,7 @@ __gmp_doprnt_mpf (const struct doprnt_funs_t *funs, int fraczeros, fraclen, preczeros; char *s, *free_ptr; mp_exp_t exp; - char exponent[BITS_PER_MP_LIMB + 10]; + char exponent[GMP_LIMB_BITS + 10]; const char *showbase; int retval = 0; diff --git a/tests/devel/addmul_N.c b/tests/devel/addmul_N.c index 3fbb11005..435810cd0 100644 --- a/tests/devel/addmul_N.c +++ b/tests/devel/addmul_N.c @@ -150,7 +150,7 @@ main (int argc, char **argv) t = cputime() - t0; cyc = ((double) t * CLOCK) / (TIMES * size * 1000.0) / N; printf ("mpn_addmul_N: %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n", - t, cyc, CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9); + t, cyc, CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9); #endif #ifdef ZEROu @@ -244,7 +244,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", LXW, p[i]); diff --git a/tests/devel/addsub_n.c b/tests/devel/addsub_n.c index 0cbd1dee3..e00bcba19 100644 --- a/tests/devel/addsub_n.c +++ b/tests/devel/addsub_n.c @@ -184,7 +184,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/addsub_n_2.c b/tests/devel/addsub_n_2.c index a1f1333d6..8e7145187 100644 --- a/tests/devel/addsub_n_2.c +++ b/tests/devel/addsub_n_2.c @@ -178,7 +178,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/anymul_1.c b/tests/devel/anymul_1.c index e3cea5380..27a1a7464 100644 --- a/tests/devel/anymul_1.c +++ b/tests/devel/anymul_1.c @@ -147,7 +147,7 @@ main (int argc, char **argv) cyc = ((double) t * CLOCK) / (TIMES * size * 1000.0); printf (funcname ": %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n", t, cyc, - CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9); + CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9); #endif #ifndef NOCHECK @@ -237,7 +237,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/aors_n.c b/tests/devel/aors_n.c index f6319ac0b..99069f2ed 100644 --- a/tests/devel/aors_n.c +++ b/tests/devel/aors_n.c @@ -214,7 +214,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/copy.c b/tests/devel/copy.c index badbe9bbf..d8cbbd968 100644 --- a/tests/devel/copy.c +++ b/tests/devel/copy.c @@ -178,7 +178,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/divmod_1.c b/tests/devel/divmod_1.c index 03b5ba04e..8487775b0 100644 --- a/tests/devel/divmod_1.c +++ b/tests/devel/divmod_1.c @@ -141,7 +141,7 @@ main () cyc = ((double) t * CLOCK) / (TIMES * nn * 1000.0); printf ("mpn_divrem_1 int: %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n", t, cyc, - CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9); + CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9); t0 = cputime(); for (i = 0; i < TIMES; i++) mpn_divrem_1 (dx + 1, fn, np, 0, dlimb); @@ -149,7 +149,7 @@ main () cyc = ((double) t * CLOCK) / (TIMES * fn * 1000.0); printf ("mpn_divrem_1 frac: %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n", t, cyc, - CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9); + CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9); #endif retx = refmpn_divrem_1 (dx + 1, fn, np, nn, dlimb); @@ -186,7 +186,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/divrem.c b/tests/devel/divrem.c index 837e2ec44..8d7622764 100644 --- a/tests/devel/divrem.c +++ b/tests/devel/divrem.c @@ -88,7 +88,7 @@ main () mpn_random2 (nptr, nsize); mpn_random2 (dptr, dsize); - dptr[dsize - 1] |= (mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1); + dptr[dsize - 1] |= (mp_limb_t) 1 << (GMP_LIMB_BITS - 1); MPN_COPY (rptr, nptr, nsize); qlimb = mpn_divrem (qptr, (mp_size_t) 0, rptr, nsize, dptr, dsize); diff --git a/tests/devel/logops_n.c b/tests/devel/logops_n.c index 56c84b286..db0be2c86 100644 --- a/tests/devel/logops_n.c +++ b/tests/devel/logops_n.c @@ -217,7 +217,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/mul_N.c b/tests/devel/mul_N.c index f60d4c7c2..cd33b5a0f 100644 --- a/tests/devel/mul_N.c +++ b/tests/devel/mul_N.c @@ -152,7 +152,7 @@ main (int argc, char **argv) t = cputime() - t0; cyc = ((double) t * CLOCK) / (TIMES * size * 1000.0) / N; printf ("mpn_mul_N: %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n", - t, cyc, CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9); + t, cyc, CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9); #endif #ifdef ZEROu @@ -242,7 +242,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", LXW, p[i]); diff --git a/tests/devel/shift.c b/tests/devel/shift.c index 09a7e7f3d..089edd3ac 100644 --- a/tests/devel/shift.c +++ b/tests/devel/shift.c @@ -194,7 +194,7 @@ mpn_print (mp_ptr p, mp_size_t size) { #ifdef _LONG_LONG_LIMB printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)), - (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)), + (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)), (int) (sizeof(mp_limb_t)), (unsigned long) (p[i])); #else printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]); diff --git a/tests/devel/try.c b/tests/devel/try.c index 98254a633..034f91f91 100644 --- a/tests/devel/try.c +++ b/tests/devel/try.c @@ -220,7 +220,7 @@ mp_size_t pagesize; #define MAX3(x,y,z) (MAX (x, MAX (y, z))) -#if BITS_PER_MP_LIMB == 32 +#if GMP_LIMB_BITS == 32 #define DEADVAL CNST_LIMB(0xDEADBEEF) #else #define DEADVAL CNST_LIMB(0xDEADBEEFBADDCAFE) diff --git a/tests/misc.c b/tests/misc.c index dbbbe7ff8..3ad27e5d2 100644 --- a/tests/misc.c +++ b/tests/misc.c @@ -370,11 +370,11 @@ urandom (void) { #if GMP_NAIL_BITS == 0 mp_limb_t n; - _gmp_rand (&n, RANDS, BITS_PER_MP_LIMB); + _gmp_rand (&n, RANDS, GMP_LIMB_BITS); return n; #else mp_limb_t n[2]; - _gmp_rand (n, RANDS, BITS_PER_MP_LIMB); + _gmp_rand (n, RANDS, GMP_LIMB_BITS); return n[0] + (n[1] << GMP_NUMB_BITS); #endif } diff --git a/tests/mpbsd/t-mtox.c b/tests/mpbsd/t-mtox.c index b6c489cad..1138e7623 100644 --- a/tests/mpbsd/t-mtox.c +++ b/tests/mpbsd/t-mtox.c @@ -38,7 +38,7 @@ check_random (void) for (i = 0; i < 1000; i++) { - mpz_erandomb (z, rands, 6 * BITS_PER_MP_LIMB); + mpz_erandomb (z, rands, 6 * GMP_LIMB_BITS); got = mtox (z); want = mpz_get_str (NULL, 16, z); if (strcmp (got, want) != 0) diff --git a/tests/mpf/t-conv.c b/tests/mpf/t-conv.c index 0a51fcc00..c15117417 100644 --- a/tests/mpf/t-conv.c +++ b/tests/mpf/t-conv.c @@ -45,7 +45,7 @@ main (int argc, char **argv) mp_exp_t bexp; long size, exp; int base; - char buf[SIZE * BITS_PER_MP_LIMB + 5]; + char buf[SIZE * GMP_LIMB_BITS + 5]; tests_start (); diff --git a/tests/mpf/t-muldiv.c b/tests/mpf/t-muldiv.c index 0fc644932..3ce1292c4 100644 --- a/tests/mpf/t-muldiv.c +++ b/tests/mpf/t-muldiv.c @@ -36,7 +36,7 @@ main (int argc, char **argv) int reps = 10000; int i; mpf_t u, v, w, x; - mp_size_t bprec = SIZE * BITS_PER_MP_LIMB; + mp_size_t bprec = SIZE * GMP_LIMB_BITS; mpf_t rerr, limit_rerr; unsigned long ulimb, vlimb; int single_flag; diff --git a/tests/mpz/bit.c b/tests/mpz/bit.c index 9eddbb488..9dc551d3c 100644 --- a/tests/mpz/bit.c +++ b/tests/mpz/bit.c @@ -207,7 +207,7 @@ check_single (void) { mpz_set_si (x, (long) initial); - bit = (unsigned long) limb*BITS_PER_MP_LIMB + offset; + bit = (unsigned long) limb*GMP_LIMB_BITS + offset; mpz_clrbit (x, bit); MPZ_CHECK_FORMAT (x); diff --git a/tests/mpz/t-aorsmul.c b/tests/mpz/t-aorsmul.c index 36b7933ca..ecec5d570 100644 --- a/tests/mpz/t-aorsmul.c +++ b/tests/mpz/t-aorsmul.c @@ -388,14 +388,14 @@ check_random (int argc, char *argv[]) for (i = 0; i < reps; i++) { - mpz_errandomb (w, rands, 5*BITS_PER_MP_LIMB); - mpz_errandomb (x, rands, 5*BITS_PER_MP_LIMB); - mpz_errandomb (y, rands, 5*BITS_PER_MP_LIMB); + mpz_errandomb (w, rands, 5*GMP_LIMB_BITS); + mpz_errandomb (x, rands, 5*GMP_LIMB_BITS); + mpz_errandomb (y, rands, 5*GMP_LIMB_BITS); check_all (w, x, y); check_all_inplace (w, y); - mpz_errandomb (w, rands, 5*BITS_PER_MP_LIMB); - mpz_errandomb (x, rands, 5*BITS_PER_MP_LIMB); + mpz_errandomb (w, rands, 5*GMP_LIMB_BITS); + mpz_errandomb (x, rands, 5*GMP_LIMB_BITS); mpz_errandomb (y, rands, BITS_PER_ULONG); check_all (w, x, y); check_all_inplace (w, y); diff --git a/tests/mpz/t-cong.c b/tests/mpz/t-cong.c index 5ef444ca8..f263f2496 100644 --- a/tests/mpz/t-cong.c +++ b/tests/mpz/t-cong.c @@ -146,11 +146,11 @@ check_random (int argc, char *argv[]) for (i = 0; i < reps; i++) { - mpz_errandomb (a, rands, 8*BITS_PER_MP_LIMB); + mpz_errandomb (a, rands, 8*GMP_LIMB_BITS); MPZ_CHECK_FORMAT (a); - mpz_errandomb (c, rands, 8*BITS_PER_MP_LIMB); + mpz_errandomb (c, rands, 8*GMP_LIMB_BITS); MPZ_CHECK_FORMAT (c); - mpz_errandomb_nonzero (d, rands, 8*BITS_PER_MP_LIMB); + mpz_errandomb_nonzero (d, rands, 8*GMP_LIMB_BITS); mpz_negrandom (a, rands); MPZ_CHECK_FORMAT (a); @@ -171,7 +171,7 @@ check_random (int argc, char *argv[]) if (! mpz_pow2abs_p (d)) { - refmpz_combit (a, urandom() % (8*BITS_PER_MP_LIMB)); + refmpz_combit (a, urandom() % (8*GMP_LIMB_BITS)); check_one (a, c, d, 0); } } diff --git a/tests/mpz/t-cong_2exp.c b/tests/mpz/t-cong_2exp.c index 478f78231..fedcdf91f 100644 --- a/tests/mpz/t-cong_2exp.c +++ b/tests/mpz/t-cong_2exp.c @@ -124,12 +124,12 @@ check_random (int argc, char *argv[]) for (i = 0; i < reps; i++) { - mpz_errandomb (a, rands, 8*BITS_PER_MP_LIMB); - mpz_errandomb (c, rands, 8*BITS_PER_MP_LIMB); - d = urandom() % (8*BITS_PER_MP_LIMB); + mpz_errandomb (a, rands, 8*GMP_LIMB_BITS); + mpz_errandomb (c, rands, 8*GMP_LIMB_BITS); + d = urandom() % (8*GMP_LIMB_BITS); - mpz_mul_2exp (a, a, urandom() % (2*BITS_PER_MP_LIMB)); - mpz_mul_2exp (c, c, urandom() % (2*BITS_PER_MP_LIMB)); + mpz_mul_2exp (a, a, urandom() % (2*GMP_LIMB_BITS)); + mpz_mul_2exp (c, c, urandom() % (2*GMP_LIMB_BITS)); mpz_negrandom (a, rands); mpz_negrandom (c, rands); diff --git a/tests/mpz/t-fib_ui.c b/tests/mpz/t-fib_ui.c index 1e84a288e..77e52f5a3 100644 --- a/tests/mpz/t-fib_ui.c +++ b/tests/mpz/t-fib_ui.c @@ -73,7 +73,7 @@ int main (int argc, char *argv[]) { unsigned long n; - unsigned long limit = 100 * BITS_PER_MP_LIMB; + unsigned long limit = 100 * GMP_LIMB_BITS; mpz_t want_fn, want_fn1, got_fn, got_fn1; tests_start (); diff --git a/tests/mpz/t-fits.c b/tests/mpz/t-fits.c index dac085156..3f08802ad 100644 --- a/tests/mpz/t-fits.c +++ b/tests/mpz/t-fits.c @@ -84,7 +84,7 @@ main (void) EXPECT (mpz_fits_sshort_p, 1); mpz_set_ui (z, 1L); - mpz_mul_2exp (z, z, 5L*BITS_PER_MP_LIMB); + mpz_mul_2exp (z, z, 5L*GMP_LIMB_BITS); expr = "2^(5*BPML)"; EXPECT (mpz_fits_ulong_p, 0); EXPECT (mpz_fits_uint_p, 0); diff --git a/tests/mpz/t-io_raw.c b/tests/mpz/t-io_raw.c index 4fd71e4be..433d7d64b 100644 --- a/tests/mpz/t-io_raw.c +++ b/tests/mpz/t-io_raw.c @@ -233,7 +233,7 @@ check_rand (void) for (i = 0; i < 500; i++) { - mpz_erandomb (want, rands, 10*BITS_PER_MP_LIMB); + mpz_erandomb (want, rands, 10*GMP_LIMB_BITS); mpz_negrandom (want, rands); fp = fopen_wplusb_or_die (FILENAME); diff --git a/tests/mpz/t-lucnum_ui.c b/tests/mpz/t-lucnum_ui.c index 83f0d93b4..814034f13 100644 --- a/tests/mpz/t-lucnum_ui.c +++ b/tests/mpz/t-lucnum_ui.c @@ -35,7 +35,7 @@ void check_sequence (int argc, char *argv[]) { unsigned long n; - unsigned long limit = 100 * BITS_PER_MP_LIMB; + unsigned long limit = 100 * GMP_LIMB_BITS; mpz_t want_ln, want_ln1, got_ln, got_ln1; if (argc > 1 && argv[1][0] == 'x') diff --git a/tests/mpz/t-popcount.c b/tests/mpz/t-popcount.c index da7487d60..313bc076b 100644 --- a/tests/mpz/t-popcount.c +++ b/tests/mpz/t-popcount.c @@ -32,7 +32,7 @@ check_onebit (void) unsigned long i, got; mpz_init (n); - for (i = 0; i < 5 * BITS_PER_MP_LIMB; i++) + for (i = 0; i < 5 * GMP_LIMB_BITS; i++) { mpz_setbit (n, i); got = mpz_popcount (n); diff --git a/tests/mpz/t-set_f.c b/tests/mpz/t-set_f.c index 764006fd3..35cb61c87 100644 --- a/tests/mpz/t-set_f.c +++ b/tests/mpz/t-set_f.c @@ -28,7 +28,7 @@ void check_one (mpz_srcptr z) { static const int shift[] = { - 0, 1, BITS_PER_MP_LIMB, 2*BITS_PER_MP_LIMB, 5*BITS_PER_MP_LIMB + 0, 1, GMP_LIMB_BITS, 2*GMP_LIMB_BITS, 5*GMP_LIMB_BITS }; int sh, shneg, neg; @@ -101,10 +101,10 @@ check_various (void) mpz_set_si (z, 123L); check_one (z); - mpz_rrandomb (z, RANDS, 2*BITS_PER_MP_LIMB); + mpz_rrandomb (z, RANDS, 2*GMP_LIMB_BITS); check_one (z); - mpz_rrandomb (z, RANDS, 5*BITS_PER_MP_LIMB); + mpz_rrandomb (z, RANDS, 5*GMP_LIMB_BITS); check_one (z); mpz_clear (z); diff --git a/tests/rand/gen.c b/tests/rand/gen.c index c3f8c616a..511a3e284 100644 --- a/tests/rand/gen.c +++ b/tests/rand/gen.c @@ -277,7 +277,7 @@ int main (argc, argv) case RFUNC_mpf_urandomb: #if 0 /* Don't init a too small generator. */ - size = PREC (f1) * BITS_PER_MP_LIMB; + size = PREC (f1) * GMP_LIMB_BITS; /* Fall through. */ #endif case RFUNC_mpz_urandomb: diff --git a/tests/refmpn.c b/tests/refmpn.c index 11f6f60fc..58e955f25 100644 --- a/tests/refmpn.c +++ b/tests/refmpn.c @@ -184,7 +184,7 @@ refmpn_normalize (mp_srcptr ptr, mp_size_t size) mp_limb_t refmpn_msbone (mp_limb_t x) { - mp_limb_t n = (mp_limb_t) 1 << (BITS_PER_MP_LIMB-1); + mp_limb_t n = (mp_limb_t) 1 << (GMP_LIMB_BITS-1); while (n != 0) { @@ -735,10 +735,10 @@ refmpn_sub (mp_ptr rp, } -#define SHIFTHIGH(x) ((x) << BITS_PER_MP_LIMB/2) -#define SHIFTLOW(x) ((x) >> BITS_PER_MP_LIMB/2) +#define SHIFTHIGH(x) ((x) << GMP_LIMB_BITS/2) +#define SHIFTLOW(x) ((x) >> GMP_LIMB_BITS/2) -#define LOWMASK (((mp_limb_t) 1 << BITS_PER_MP_LIMB/2)-1) +#define LOWMASK (((mp_limb_t) 1 << GMP_LIMB_BITS/2)-1) #define HIGHMASK SHIFTHIGH(LOWMASK) #define LOWPART(x) ((x) & LOWMASK) @@ -986,7 +986,7 @@ refmpn_add_n_sub_n (mp_ptr r1p, mp_ptr r2p, /* Right shift hi,lo and return the low limb of the result. - Note a shift by BITS_PER_MP_LIMB isn't assumed to work (doesn't on x86). */ + Note a shift by GMP_LIMB_BITS isn't assumed to work (doesn't on x86). */ mp_limb_t rshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift) { @@ -998,7 +998,7 @@ rshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift) } /* Left shift hi,lo and return the high limb of the result. - Note a shift by BITS_PER_MP_LIMB isn't assumed to work (doesn't on x86). */ + Note a shift by GMP_LIMB_BITS isn't assumed to work (doesn't on x86). */ mp_limb_t lshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift) { @@ -1288,7 +1288,7 @@ refmpn_divrem_2 (mp_ptr qp, mp_size_t qxn, } /* Inverse is floor((b*(b-d)-1) / d), per division by invariant integers - paper, figure 8.1 m', where b=2^BITS_PER_MP_LIMB. Note that -d-1 < d + paper, figure 8.1 m', where b=2^GMP_LIMB_BITS. Note that -d-1 < d since d has the high bit set. */ mp_limb_t @@ -1905,10 +1905,10 @@ ref_bswap_limb (mp_limb_t src) can probably be removed when those normal routines are reliable, though perhaps something independent would still be useful at times. */ -#if BITS_PER_MP_LIMB == 32 +#if GMP_LIMB_BITS == 32 #define RAND_A CNST_LIMB(0x29CF535) #endif -#if BITS_PER_MP_LIMB == 64 +#if GMP_LIMB_BITS == 64 #define RAND_A CNST_LIMB(0xBAECD515DAF0B49D) #endif @@ -1918,13 +1918,13 @@ mp_limb_t refmpn_random_half (void) { refmpn_random_seed = refmpn_random_seed * RAND_A + 1; - return (refmpn_random_seed >> BITS_PER_MP_LIMB/2); + return (refmpn_random_seed >> GMP_LIMB_BITS/2); } mp_limb_t refmpn_random_limb (void) { - return ((refmpn_random_half () << (BITS_PER_MP_LIMB/2)) + return ((refmpn_random_half () << (GMP_LIMB_BITS/2)) | refmpn_random_half ()) & GMP_NUMB_MASK; } diff --git a/tests/t-constants.c b/tests/t-constants.c index ef63c09c9..1c267e678 100644 --- a/tests/t-constants.c +++ b/tests/t-constants.c @@ -209,10 +209,9 @@ main (int argc, char *argv[]) int error = 0; CHECK_INT (BYTES_PER_MP_LIMB, (int) sizeof(mp_limb_t)); - CHECK_INT (mp_bits_per_limb, BITS_PER_MP_LIMB); - CHECK_INT (__GMP_BITS_PER_MP_LIMB, BITS_PER_MP_LIMB); + CHECK_INT (mp_bits_per_limb, GMP_LIMB_BITS); - CHECK_BITS (BITS_PER_MP_LIMB, mp_limb_t); + CHECK_BITS (GMP_LIMB_BITS, mp_limb_t); CHECK_BITS (BITS_PER_ULONG, unsigned long); CHECK_HIGHBIT (GMP_LIMB_HIGHBIT, mp_limb_t, LL("0x%lX","0x%llX")); diff --git a/tests/t-count_zeros.c b/tests/t-count_zeros.c index 85955dcba..8dc34eb03 100644 --- a/tests/t-count_zeros.c +++ b/tests/t-count_zeros.c @@ -63,9 +63,9 @@ check_various (void) check_clz (COUNT_LEADING_ZEROS_0, CNST_LIMB(0)); #endif - for (i=0; i < BITS_PER_MP_LIMB; i++) + for (i=0; i < GMP_LIMB_BITS; i++) { - check_clz (i, CNST_LIMB(1) << (BITS_PER_MP_LIMB-1-i)); + check_clz (i, CNST_LIMB(1) << (GMP_LIMB_BITS-1-i)); check_ctz (i, CNST_LIMB(1) << i); check_ctz (i, MP_LIMB_T_MAX << i); diff --git a/tune/common.c b/tune/common.c index bd576e7de..004bb4444 100644 --- a/tune/common.c +++ b/tune/common.c @@ -2025,7 +2025,7 @@ speed_operator_mod (struct speed_params *s) be typical for count_trailing_zeros in a GCD etc. r==1 measures on data with the resultant count uniformly distributed - between 0 and BITS_PER_MP_LIMB-1. This is probably sensible for + between 0 and GMP_LIMB_BITS-1. This is probably sensible for count_leading_zeros on the high limbs of divisors. */ int @@ -2052,7 +2052,7 @@ speed_routine_count_zeros_setup (struct speed_params *s, rest below. */ for (i = 0; i < SPEED_BLOCK_SIZE; i++) { - mp_limb_t set = CNST_LIMB(1) << (s->yp_block[i] % BITS_PER_MP_LIMB); + mp_limb_t set = CNST_LIMB(1) << (s->yp_block[i] % GMP_LIMB_BITS); mp_limb_t keep_below = set-1; mp_limb_t keep_above = MP_LIMB_T_MAX ^ keep_below; mp_limb_t keep = (leading ? keep_below : keep_above); diff --git a/tune/modlinv.c b/tune/modlinv.c index 3ed0c8a03..77c7013ba 100644 --- a/tune/modlinv.c +++ b/tune/modlinv.c @@ -30,7 +30,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ dependent chain, whereas the "2*" in the standard version isn't. Depending on the CPU this should be the same or a touch slower. */ -#if BITS_PER_MP_LIMB <= 32 +#if GMP_LIMB_BITS <= 32 #define binvert_limb_mul1(inv,n) \ do { \ mp_limb_t __n = (n); \ @@ -44,7 +44,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ } while (0) #endif -#if BITS_PER_MP_LIMB > 32 && BITS_PER_MP_LIMB <= 64 +#if GMP_LIMB_BITS > 32 && GMP_LIMB_BITS <= 64 #define binvert_limb_mul1(inv,n) \ do { \ mp_limb_t __n = (n); \ @@ -100,7 +100,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ \ ASSERT ((__n & 1) == 1); \ \ - __count = BITS_PER_MP_LIMB-1; \ + __count = GMP_LIMB_BITS-1; \ do \ { \ __inv >>= 1; \ @@ -131,11 +131,11 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ \ ASSERT ((__n & 1) == 1); \ \ - __count = BITS_PER_MP_LIMB-1; \ + __count = GMP_LIMB_BITS-1; \ do \ { \ __lowbit = __rem & 1; \ - __inv = (__inv >> 1) | (__lowbit << (BITS_PER_MP_LIMB-1)); \ + __inv = (__inv >> 1) | (__lowbit << (GMP_LIMB_BITS-1)); \ __rem = (__rem - (__n & -__lowbit)) >> 1; \ } \ while (-- __count); \ diff --git a/tune/speed-ext.c b/tune/speed-ext.c index 04760a5ea..2035fa80d 100644 --- a/tune/speed-ext.c +++ b/tune/speed-ext.c @@ -82,8 +82,8 @@ mean_calls (mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size) ASSERT (size >= 1); c = mpn_add_n (wp, xp, yp, size); - ret = mpn_rshift (wp, wp, size, 1) >> (BITS_PER_MP_LIMB-1); - wp[size-1] |= (c << (BITS_PER_MP_LIMB-1)); + ret = mpn_rshift (wp, wp, size, 1) >> (GMP_LIMB_BITS-1); + wp[size-1] |= (c << (GMP_LIMB_BITS-1)); return ret; } @@ -107,7 +107,7 @@ mean_open (mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size) c = (wprev < x); ret = (wprev & 1); -#define RSHIFT(hi,lo) (((lo) >> 1) | ((hi) << (BITS_PER_MP_LIMB-1))) +#define RSHIFT(hi,lo) (((lo) >> 1) | ((hi) << (GMP_LIMB_BITS-1))) for (i = 1; i < size; i++) { diff --git a/tune/speed.c b/tune/speed.c index c1577415f..4ebb90c21 100644 --- a/tune/speed.c +++ b/tune/speed.c @@ -90,10 +90,10 @@ SPEED_EXTRA_PROTOS2 } while (0) -#if BITS_PER_MP_LIMB == 32 +#if GMP_LIMB_BITS == 32 #define GMP_NUMB_0xAA (CNST_LIMB(0xAAAAAAAA) & GMP_NUMB_MASK) #endif -#if BITS_PER_MP_LIMB == 64 +#if GMP_LIMB_BITS == 64 #define GMP_NUMB_0xAA (CNST_LIMB(0xAAAAAAAAAAAAAAAA) & GMP_NUMB_MASK) #endif @@ -792,7 +792,7 @@ run_gnuplot (int argc, char *argv[]) /* Return a limb with n many one bits (starting from the least significant) */ #define LIMB_ONES(n) \ - ((n) == BITS_PER_MP_LIMB ? MP_LIMB_T_MAX \ + ((n) == GMP_LIMB_BITS ? MP_LIMB_T_MAX \ : (n) == 0 ? CNST_LIMB(0) \ : (CNST_LIMB(1) << (n)) - 1) @@ -819,7 +819,7 @@ r_string (const char *s) { if (siz > 1 || siz < -1) printf ("Warning, r parameter %s truncated to %d bits\n", - s_orig, BITS_PER_MP_LIMB); + s_orig, GMP_LIMB_BITS); return l; } } @@ -832,10 +832,10 @@ r_string (const char *s) if (strcmp (s, "bits") == 0) { mp_limb_t l; - if (n > BITS_PER_MP_LIMB) + if (n > GMP_LIMB_BITS) { fprintf (stderr, "%ld bit parameter invalid (max %d bits)\n", - n, BITS_PER_MP_LIMB); + n, GMP_LIMB_BITS); exit (1); } mpn_random (&l, 1); @@ -843,10 +843,10 @@ r_string (const char *s) } else if (strcmp (s, "ones") == 0) { - if (n > BITS_PER_MP_LIMB) + if (n > GMP_LIMB_BITS) { fprintf (stderr, "%ld bit parameter invalid (max %d bits)\n", - n, BITS_PER_MP_LIMB); + n, GMP_LIMB_BITS); exit (1); } return LIMB_ONES (n); diff --git a/tune/speed.h b/tune/speed.h index 1e396b7f7..d4d199360 100644 --- a/tune/speed.h +++ b/tune/speed.h @@ -31,9 +31,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ } while (0) /* A mask of the least significant n bits. Note 1<<32 doesn't give zero on - x86 family CPUs, hence the separate case for BITS_PER_MP_LIMB. */ + x86 family CPUs, hence the separate case for GMP_LIMB_BITS. */ #define MP_LIMB_T_LOWBITMASK(n) \ - ((n) == BITS_PER_MP_LIMB ? MP_LIMB_T_MAX : ((mp_limb_t) 1 << (n)) - 1) + ((n) == GMP_LIMB_BITS ? MP_LIMB_T_MAX : ((mp_limb_t) 1 << (n)) - 1) /* align must be a power of 2 here, usually CACHE_LINE_SIZE is a good choice */ @@ -1274,7 +1274,7 @@ int speed_routine_count_zeros_setup /* high part less than d, low part a duplicate copied in */ \ mpz_init_set_n (a, s->xp, s->size); \ mpz_mod (a, a, d); \ - mpz_mul_2exp (a, a, BITS_PER_MP_LIMB * s->size); \ + mpz_mul_2exp (a, a, GMP_LIMB_BITS * s->size); \ MPN_COPY (PTR(a), s->xp, s->size); \ \ mpz_init (r); \ @@ -2188,7 +2188,7 @@ int speed_routine_count_zeros_setup xp[i] = s->xp[i] % base; \ \ wn = ((mp_size_t) (s->size / mp_bases[base].chars_per_bit_exactly)) \ - / BITS_PER_MP_LIMB + 2; \ + / GMP_LIMB_BITS + 2; \ SPEED_TMP_ALLOC_LIMBS (wp, wn, s->align_wp); \ \ /* use this during development to check wn is big enough */ \ diff --git a/tune/tuneup.c b/tune/tuneup.c index 70e1e5282..5eee063c4 100644 --- a/tune/tuneup.c +++ b/tune/tuneup.c @@ -670,7 +670,7 @@ fft_step_size (int k) { mp_size_t step; - step = MAX ((mp_size_t) 1 << (k-1), BITS_PER_MP_LIMB) / BITS_PER_MP_LIMB; + step = MAX ((mp_size_t) 1 << (k-1), GMP_LIMB_BITS) / GMP_LIMB_BITS; step *= (mp_size_t) 1 << k; if (step <= 0) @@ -1586,7 +1586,7 @@ tune_jacobi_base (void) double t1, t2, t3; int method; - s.size = BITS_PER_MP_LIMB * 3 / 4; + s.size = GMP_LIMB_BITS * 3 / 4; t1 = tuneup_measure (speed_mpn_jacobi_base_1, ¶m, &s); if (option_trace >= 1) @@ -1671,7 +1671,7 @@ speed_mpn_pre_set_str (struct speed_params *s) str[i] = s->xp[i] % base; wn = ((mp_size_t) (s->size / mp_bases[base].chars_per_bit_exactly)) - / BITS_PER_MP_LIMB + 2; + / GMP_LIMB_BITS + 2; SPEED_TMP_ALLOC_LIMBS (wp, wn, s->align_wp); /* use this during development to check wn is big enough */ |