diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-25 16:24:11 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-25 16:24:11 (GMT) |
commit | 44f5f557eff96e7d4f2f5aede487c3ab6fe41063 (patch) | |
tree | 120e4c636d5717e7473b89dfe9f4b726e6d0613d | |
parent | e22b6eb9ab3f112da9df627518d50d30615d655f (diff) | |
parent | d31b63df9cce749a88f06ee81883cbe92be28c77 (diff) | |
download | tcl-44f5f557eff96e7d4f2f5aede487c3ab6fe41063.zip tcl-44f5f557eff96e7d4f2f5aede487c3ab6fe41063.tar.gz tcl-44f5f557eff96e7d4f2f5aede487c3ab6fe41063.tar.bz2 |
Merge 8.6.
Also remove unused variable in unix/tclUnixFile.c
-rw-r--r-- | generic/tclInt.h | 2 | ||||
-rw-r--r-- | generic/tclStrToD.c | 26 | ||||
-rw-r--r-- | generic/tclStubInit.c | 2 | ||||
-rw-r--r-- | generic/tclTomMathDecls.h | 27 | ||||
-rw-r--r-- | libtommath/bn_mp_sqrt.c | 10 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 1 |
6 files changed, 29 insertions, 39 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 1fe3822..a4e6f55 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4193,7 +4193,7 @@ MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr, int before, int after, int *indexPtr); MODULE_SCOPE int TclIndexDecode(int encoded, int endValue); -MODULE_SCOPE void TclBN_int_reverse(unsigned char *s, size_t len); +MODULE_SCOPE void TclBN_s_mp_reverse(unsigned char *s, size_t len); /* Constants used in index value encoding routines. */ #define TCL_INDEX_END (-2) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index cb55e14..402735f 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -145,7 +145,7 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); #define QUICK_MAX 14 /* floor((FP_PRECISION-1)*log(2)/log(10))-1 */ #define BLETCH 0x10 /* Highest power of two that is greater than * DBL_MAX_10_EXP, divided by 16. */ -#define DIGIT_GROUP 8 /* floor(DIGIT_BIT*log(2)/log(10)) */ +#define DIGIT_GROUP 8 /* floor(MP_DIGIT_BIT*log(2)/log(10)) */ /* * Union used to dismantle floating point numbers. @@ -1485,9 +1485,9 @@ AccumulateDecimalDigit( * More than single digit multiplication. Multiply by the appropriate * small powers of 5, and then shift. Large strings of zeroes are * eaten 256 at a time; this is less efficient than it could be, but - * seems implausible. We presume that DIGIT_BIT is at least 27. The + * seems implausible. We presume that MP_DIGIT_BIT is at least 27. The * first multiplication, by up to 10**7, is done with a one-DIGIT - * multiply (this presumes that DIGIT_BIT >= 24). + * multiply (this presumes that MP_DIGIT_BIT >= 24). */ n = numZeros + 1; @@ -3129,7 +3129,7 @@ StrictInt64Conversion( * * Test whether bankers' rounding should round a digit up. Assumption is * made that the denominator of the fraction being tested is a power of - * 2**DIGIT_BIT. + * 2**MP_DIGIT_BIT. * * Results: * Returns 1 iff the fraction is more than 1/2, or if the fraction is @@ -3141,7 +3141,7 @@ StrictInt64Conversion( static inline int ShouldBankerRoundUpPowD( mp_int *b, /* Numerator of the fraction. */ - int sd, /* Denominator is 2**(sd*DIGIT_BIT). */ + int sd, /* Denominator is 2**(sd*MP_DIGIT_BIT). */ int isodd) /* 1 if the digit is odd, 0 if even. */ { int i; @@ -3180,7 +3180,7 @@ static inline int ShouldBankerRoundUpToNextPowD( mp_int *b, /* Numerator of the fraction. */ mp_int *m, /* Numerator of the rounding tolerance. */ - int sd, /* Common denominator is 2**(sd*DIGIT_BIT). */ + int sd, /* Common denominator is 2**(sd*MP_DIGIT_BIT). */ int isodd, /* 1 if the integer significand is odd. */ mp_int *temp) /* Work area for the calculation. */ { @@ -3189,7 +3189,7 @@ ShouldBankerRoundUpToNextPowD( /* * Compare B and S-m - which is the same as comparing B+m and S - which we * do by computing b+m and doing a bitwhack compare against - * 2**(DIGIT_BIT*sd) + * 2**(MP_DIGIT_BIT*sd) */ mp_add(b, m, temp); @@ -3217,7 +3217,7 @@ ShouldBankerRoundUpToNextPowD( * Converts a double-precision number to the shortest string of digits * that reconverts exactly to the given number, or to 'ilim' digits if * that will yield a shorter result. The denominator in David Gay's - * conversion algorithm is known to be a power of 2**DIGIT_BIT, and hence + * conversion algorithm is known to be a power of 2**MP_DIGIT_BIT, and hence * the division in the main loop may be replaced by a digit shift and * mask. * @@ -3297,7 +3297,7 @@ ShorteningBignumConversionPowD( mp_init(&temp); /* - * Loop through the digits. Do division and mod by s == 2**(sd*DIGIT_BIT) + * Loop through the digits. Do division and mod by s == 2**(sd*MP_DIGIT_BIT) * by mp_digit extraction. */ @@ -3409,7 +3409,7 @@ ShorteningBignumConversionPowD( * Converts a double-precision number to a fixed-lengt string of 'ilim' * digits (or 'ilim1' if log10(d) has been overestimated). The * denominator in David Gay's conversion algorithm is known to be a power - * of 2**DIGIT_BIT, and hence the division in the main loop may be + * of 2**MP_DIGIT_BIT, and hence the division in the main loop may be * replaced by a digit shift and mask. * * Results: @@ -3466,7 +3466,7 @@ StrictBignumConversionPowD( } /* - * Loop through the digits. Do division and mod by s == 2**(sd*DIGIT_BIT) + * Loop through the digits. Do division and mod by s == 2**(sd*MP_DIGIT_BIT) * by mp_digit extraction. */ @@ -4208,7 +4208,7 @@ TclDoubleDigits( } else if (s5 == 0) { /* * The denominator is a power of 2, so we can replace division by - * digit shifts. First we round up s2 to a multiple of DIGIT_BIT, + * digit shifts. First we round up s2 to a multiple of MP_DIGIT_BIT, * and adjust m2 and b2 accordingly. Then we launch into a version * of the comparison that's specialized for the 'power of mp_digit * in the denominator' case. @@ -4264,7 +4264,7 @@ TclDoubleDigits( } else if (s5 == 0) { /* * The denominator is a power of 2, so we can replace division by - * digit shifts. First we round up s2 to a multiple of DIGIT_BIT, + * digit shifts. First we round up s2 to a multiple of MP_DIGIT_BIT, * and adjust m2 and b2 accordingly. Then we launch into a version * of the comparison that's specialized for the 'power of mp_digit * in the denominator' case. diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ccffa78..76ddcae 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -103,6 +103,7 @@ static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i) # define TclBN_mp_expt_d_ex 0 # define TclBN_mp_to_unsigned_bin 0 # define TclBN_mp_to_unsigned_bin_n 0 +# define TclBN_mp_toradix_n 0 # define TclSetStartupScriptPath 0 # define TclGetStartupScriptPath 0 # define TclSetStartupScriptFileName 0 @@ -533,7 +534,6 @@ tellOld( #define Tcl_WinTCharToUtf 0 #endif - /* * WARNING: The contents of this file is automatically generated by the * tools/genStubs.tcl script. Any modifications to the function declarations diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 574ee86..0e19ea4 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -51,11 +51,6 @@ /* Rename the global symbols in libtommath to avoid linkage conflicts */ #define bn_reverse TclBN_reverse -#define s_mp_reverse TclBN_int_reverse -#define fast_s_mp_mul_digs TclBN_fast_s_mp_mul_digs -#define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs -#define fast_s_mp_sqr TclBN_fast_s_mp_sqr -#define s_mp_sqr_fast TclBN_fast_s_mp_sqr #define mp_add TclBN_mp_add #define mp_add_d TclBN_mp_add_d #define mp_and TclBN_mp_and @@ -78,13 +73,9 @@ #define mp_expt_d_ex TclBN_mp_expt_d_ex #define mp_expt_u32 TclBN_mp_expt_u32 #define mp_get_bit TclBN_mp_get_bit -#define mp_get_long TclBN_mp_get_mag_ul #define mp_get_mag_ul TclBN_mp_get_mag_ul -#define mp_get_long_long TclBN_mp_get_mag_ull #define mp_get_mag_ull TclBN_mp_get_mag_ull #define mp_grow TclBN_mp_grow -#define s_mp_get_bit TclBN_mp_get_bit -#define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init #define mp_init_copy TclBN_mp_init_copy #define mp_init_multi TclBN_mp_init_multi @@ -92,10 +83,6 @@ #define mp_init_set_int(a,i) (MP_DEPRECATED_PRAGMA("replaced by mp_init_ul") TclBN_mp_init_ul(a,(unsigned int)(i))) #define mp_init_size TclBN_mp_init_size #define mp_init_ul TclBN_mp_init_ul -#define mp_karatsuba_mul TclBN_mp_karatsuba_mul -#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul -#define mp_karatsuba_sqr TclBN_mp_karatsuba_sqr -#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr #define mp_isodd TclBN_mp_isodd #define mp_lshd TclBN_mp_lshd #define mp_mod TclBN_mp_mod @@ -127,11 +114,6 @@ #define mp_tc_xor TclBN_mp_xor #define mp_to_unsigned_bin TclBN_mp_to_unsigned_bin #define mp_to_unsigned_bin_n TclBN_mp_to_unsigned_bin_n -#define mp_toom_mul TclBN_mp_toom_mul -#define s_mp_toom_mul TclBN_mp_toom_mul -#define s_mp_balance_mul TclBN_mp_balance_mul -#define mp_toom_sqr TclBN_mp_toom_sqr -#define s_mp_toom_sqr TclBN_mp_toom_sqr #define mp_toradix_n TclBN_mp_toradix_n #define mp_to_radix TclBN_mp_to_radix #define mp_to_ubin TclBN_mp_to_ubin @@ -140,9 +122,18 @@ #define mp_xor TclBN_mp_xor #define mp_zero TclBN_mp_zero #define s_mp_add TclBN_s_mp_add +#define s_mp_balance_mul TclBN_mp_balance_mul +#define s_mp_get_bit TclBN_mp_get_bit +#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul +#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr #define s_mp_mul_digs TclBN_s_mp_mul_digs +#define s_mp_mul_digs_fast TclBN_fast_s_mp_mul_digs +#define s_mp_reverse TclBN_s_mp_reverse #define s_mp_sqr TclBN_s_mp_sqr +#define s_mp_sqr_fast TclBN_fast_s_mp_sqr #define s_mp_sub TclBN_s_mp_sub +#define s_mp_toom_mul TclBN_mp_toom_mul +#define s_mp_toom_sqr TclBN_mp_toom_sqr #undef TCL_STORAGE_CLASS #ifdef BUILD_tcl diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index aaeac1d..4481d3a 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -5,7 +5,7 @@ #ifndef NO_FLOATING_POINT #include <math.h> -#if (DIGIT_BIT != 28) || (FLT_RADIX != 2) || (DBL_MANT_DIG != 53) || (DBL_MAX_EXP != 1024) +#if (MP_DIGIT_BIT != 28) || (FLT_RADIX != 2) || (DBL_MANT_DIG != 53) || (DBL_MAX_EXP != 1024) #define NO_FLOATING_POINT #endif #endif @@ -52,7 +52,7 @@ mp_err mp_sqrt(const mp_int *arg, mp_int *ret) d = 0.0; for (k = arg->used-1; k >= j; --k) { - d = ldexp(d, DIGIT_BIT) + (double)(arg->dp[k]); + d = ldexp(d, MP_DIGIT_BIT) + (double)(arg->dp[k]); } /* @@ -64,18 +64,18 @@ mp_err mp_sqrt(const mp_int *arg, mp_int *ret) /* dig is the most significant mp_digit of the square root */ - dig = (mp_digit) ldexp(d, -DIGIT_BIT); + dig = (mp_digit) ldexp(d, -MP_DIGIT_BIT); /* * If the most significant digit is nonzero, find the next digit down - * by subtracting DIGIT_BIT times thie most significant digit. + * by subtracting MP_DIGIT_BIT times thie most significant digit. * Subtract one from the result so that our initial estimate is always * low. */ if (dig) { t1.used = i+2; - d -= ldexp((double) dig, DIGIT_BIT); + d -= ldexp((double) dig, MP_DIGIT_BIT); if (d >= 1.0) { t1.dp[i+1] = dig; t1.dp[i] = ((mp_digit) d) - 1; diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 8268132..bf033d2 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -267,7 +267,6 @@ TclpMatchInDirectory( Tcl_StatBuf statBuf; Tcl_DString ds; /* native encoding of dir */ Tcl_DString dsOrig; /* utf-8 encoding of dir */ - Tcl_Encoding encoding = Tcl_GetEncoding(interp ,NULL); Tcl_DStringInit(&dsOrig); dirName = TclGetString(fileNamePtr); |