summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-16 17:08:29 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-16 17:08:29 (GMT)
commite49055022daf853edd8df42e1f9a6772f4e37422 (patch)
tree89baf9b89fc28cb563ce890deee2b7b4c0eb90b5
parentac2d3d306fac127f93a339a0934c34a91514ef5d (diff)
parentd36751c671764d5351700a2ca73e18f78bd6aae8 (diff)
downloadtcl-e49055022daf853edd8df42e1f9a6772f4e37422.zip
tcl-e49055022daf853edd8df42e1f9a6772f4e37422.tar.gz
tcl-e49055022daf853edd8df42e1f9a6772f4e37422.tar.bz2
Merge 8.7
-rw-r--r--generic/tclExecute.c48
-rw-r--r--generic/tclObj.c12
-rw-r--r--generic/tclStrToD.c12
3 files changed, 36 insertions, 36 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 622ddfd..9fe6179 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1800,7 +1800,7 @@ TclIncrObj(
w1 = *((const Tcl_WideInt *)ptr1);
w2 = *((const Tcl_WideInt *)ptr2);
- sum = w1 + w2;
+ sum = (Tcl_WideInt)((Tcl_WideUInt)w1 + (Tcl_WideUInt)w2);
/*
* Check for overflow.
@@ -3569,7 +3569,7 @@ TEBCresume(
if (GetNumberFromObj(NULL, objPtr, &ptr, &type) == TCL_OK) {
if (type == TCL_NUMBER_INT) {
Tcl_WideInt augend = *((const Tcl_WideInt *)ptr);
- Tcl_WideInt sum = augend + increment;
+ Tcl_WideInt sum = (Tcl_WideInt)((Tcl_WideUInt)augend + (Tcl_WideUInt)increment);
/*
* Overflow when (augend and sum have different sign) and
@@ -5885,7 +5885,7 @@ TEBCresume(
switch (*pc) {
case INST_ADD:
- wResult = w1 + w2;
+ wResult = (Tcl_WideInt)((Tcl_WideUInt)w1 + (Tcl_WideUInt)w2);
/*
* Check for overflow.
*/
@@ -5896,7 +5896,7 @@ TEBCresume(
goto wideResultOfArithmetic;
case INST_SUB:
- wResult = w1 - w2;
+ wResult = (Tcl_WideInt)((Tcl_WideUInt)w1 - (Tcl_WideUInt)w2);
/*
* Must check for overflow. The macro tests for overflows in
* sums by looking at the sign bits. As we have a subtraction
@@ -7139,20 +7139,20 @@ TEBCresume(
#ifdef TCL_WIDE_CLICKS
wval = TclpGetWideClicks();
#else
- wval = (Tcl_WideInt) TclpGetClicks();
+ wval = (Tcl_WideInt)TclpGetClicks();
#endif
break;
case 1: /* microseconds */
Tcl_GetTime(&now);
- wval = (Tcl_WideInt) now.sec * 1000000 + now.usec;
+ wval = (Tcl_WideInt)now.sec * 1000000 + now.usec;
break;
case 2: /* milliseconds */
Tcl_GetTime(&now);
- wval = (Tcl_WideInt) now.sec * 1000 + now.usec / 1000;
+ wval = (Tcl_WideInt)now.sec * 1000 + now.usec / 1000;
break;
case 3: /* seconds */
Tcl_GetTime(&now);
- wval = (Tcl_WideInt) now.sec;
+ wval = (Tcl_WideInt)now.sec;
break;
default:
Tcl_Panic("clockRead instruction with unknown clock#");
@@ -7413,7 +7413,7 @@ TEBCresume(
fprintf(stdout, " ... found catch at %d, catchTop=%d, "
"unwound to %ld, new pc %u\n",
rangePtr->codeOffset, (int) (catchTop - initCatchTop - 1),
- (long) *catchTop, (unsigned) rangePtr->catchOffset);
+ (long)*catchTop, (unsigned) rangePtr->catchOffset);
}
#endif
pc = (codePtr->codeStart + rangePtr->catchOffset);
@@ -7760,12 +7760,12 @@ ExecuteExtendedBinaryMathOp(
* TODO: examine for logic simplification
*/
- if (((wQuotient < (Tcl_WideInt) 0)
- || ((wQuotient == (Tcl_WideInt) 0)
+ if (((wQuotient < 0)
+ || ((wQuotient == 0)
&& ((w1 < 0 && w2 > 0)
|| (w1 > 0 && w2 < 0))))
&& (wQuotient * w2 != w1)) {
- wQuotient -= (Tcl_WideInt) 1;
+ wQuotient -= 1;
}
wRemainder = w1 - w2*wQuotient;
WIDE_RESULT(wRemainder);
@@ -7774,7 +7774,7 @@ ExecuteExtendedBinaryMathOp(
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
/* TODO: internals intrusion */
- if ((w1 > ((Tcl_WideInt) 0)) ^ !mp_isneg(&big2)) {
+ if ((w1 > ((Tcl_WideInt)0)) ^ !mp_isneg(&big2)) {
/*
* Arguments are opposite sign; remainder is sum.
*/
@@ -8044,7 +8044,7 @@ ExecuteExtendedBinaryMathOp(
}
negativeExponent = (w2 < 0);
- oddExponent = (int) (w2 & (Tcl_WideInt)1);
+ oddExponent = (int)w2 & 1;
} else {
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
negativeExponent = mp_isneg(&big2);
@@ -8134,8 +8134,8 @@ ExecuteExtendedBinaryMathOp(
* Reduce small powers of 2 to shifts.
*/
- if ((Tcl_WideUInt) w2 < (Tcl_WideUInt) CHAR_BIT*sizeof(Tcl_WideInt) - 1) {
- WIDE_RESULT(((Tcl_WideInt) 1) << (int)w2);
+ if ((Tcl_WideUInt)w2 < (Tcl_WideUInt)CHAR_BIT*sizeof(Tcl_WideInt) - 1) {
+ WIDE_RESULT(((Tcl_WideInt)1) << (int)w2);
}
goto overflowExpon;
}
@@ -8146,8 +8146,8 @@ ExecuteExtendedBinaryMathOp(
* Reduce small powers of 2 to shifts.
*/
- if ((Tcl_WideUInt) w2 < CHAR_BIT * sizeof(Tcl_WideInt) - 1) {
- WIDE_RESULT(signum * (((Tcl_WideInt) 1) << (int) w2));
+ if ((Tcl_WideUInt)w2 < CHAR_BIT * sizeof(Tcl_WideInt) - 1) {
+ WIDE_RESULT(signum * (((Tcl_WideInt)1) << (int) w2));
}
goto overflowExpon;
}
@@ -8278,7 +8278,7 @@ ExecuteExtendedBinaryMathOp(
switch (opcode) {
case INST_ADD:
- wResult = w1 + w2;
+ wResult = (Tcl_WideInt)((Tcl_WideUInt)w1 + (Tcl_WideUInt)w2);
if ((type1 == TCL_NUMBER_INT) || (type2 == TCL_NUMBER_INT))
{
/*
@@ -8292,7 +8292,7 @@ ExecuteExtendedBinaryMathOp(
break;
case INST_SUB:
- wResult = w1 - w2;
+ wResult = (Tcl_WideInt)((Tcl_WideUInt)w1 - (Tcl_WideUInt)w2);
if ((type1 == TCL_NUMBER_INT) || (type2 == TCL_NUMBER_INT))
{
/*
@@ -8518,7 +8518,7 @@ TclCompareTwoNumbers(
* doubles.
*/
- if (DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt) || w1 == (Tcl_WideInt) d1
+ if (DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt) || w1 == (Tcl_WideInt)d1
|| modf(d2, &tmp) != 0.0) {
goto doubleCompare;
}
@@ -8541,7 +8541,7 @@ TclCompareTwoNumbers(
if (d2 > (double)WIDE_MAX) {
return MP_LT;
}
- w2 = (Tcl_WideInt) d2;
+ w2 = (Tcl_WideInt)d2;
goto wideCompare;
case TCL_NUMBER_BIG:
Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2);
@@ -8566,7 +8566,7 @@ TclCompareTwoNumbers(
w2 = *((const Tcl_WideInt *)ptr2);
d2 = (double) w2;
if (DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt)
- || w2 == (Tcl_WideInt) d2 || modf(d1, &tmp) != 0.0) {
+ || w2 == (Tcl_WideInt)d2 || modf(d1, &tmp) != 0.0) {
goto doubleCompare;
}
if (d1 < (double)WIDE_MIN) {
@@ -8575,7 +8575,7 @@ TclCompareTwoNumbers(
if (d1 > (double)WIDE_MAX) {
return MP_GT;
}
- w1 = (Tcl_WideInt) d1;
+ w1 = (Tcl_WideInt)d1;
goto wideCompare;
case TCL_NUMBER_BIG:
if (TclIsInfinite(d1)) {
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 37dae8d..09d8168 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -2606,7 +2606,7 @@ Tcl_GetLongFromObj(
if (w >= (Tcl_WideInt)(LONG_MIN)
&& w <= (Tcl_WideInt)(ULONG_MAX)) {
- *longPtr = (long) w;
+ *longPtr = (long)w;
return TCL_OK;
}
goto tooLarge;
@@ -2642,12 +2642,12 @@ Tcl_GetLongFromObj(
}
if (big.sign) {
if (value <= 1 + (unsigned long)LONG_MAX) {
- *longPtr = - (long) value;
+ *longPtr = (long)(-value);
return TCL_OK;
}
} else {
if (value <= (unsigned long)ULONG_MAX) {
- *longPtr = (long) value;
+ *longPtr = (long)value;
return TCL_OK;
}
}
@@ -2881,12 +2881,12 @@ Tcl_GetWideIntFromObj(
}
if (big.sign) {
if (value <= 1 + ~(Tcl_WideUInt)WIDE_MIN) {
- *wideIntPtr = - (Tcl_WideInt) value;
+ *wideIntPtr = (Tcl_WideInt)(-value);
return TCL_OK;
}
} else {
if (value <= (Tcl_WideUInt)WIDE_MAX) {
- *wideIntPtr = (Tcl_WideInt) value;
+ *wideIntPtr = (Tcl_WideInt)value;
return TCL_OK;
}
}
@@ -3352,7 +3352,7 @@ Tcl_SetBignumObj(
goto tooLargeForWide;
}
if (bignumValue->sign) {
- TclSetIntObj(objPtr, -(Tcl_WideInt)value);
+ TclSetIntObj(objPtr, (Tcl_WideInt)(-value));
} else {
TclSetIntObj(objPtr, (Tcl_WideInt)value);
}
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index f6fe00f..c6550f4 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -1383,10 +1383,10 @@ TclParseNumber(
objPtr->typePtr = &tclIntType;
if (signum) {
objPtr->internalRep.wideValue =
- - (Tcl_WideInt) octalSignificandWide;
+ (Tcl_WideInt)(-octalSignificandWide);
} else {
objPtr->internalRep.wideValue =
- (Tcl_WideInt) octalSignificandWide;
+ (Tcl_WideInt)octalSignificandWide;
}
}
}
@@ -1419,10 +1419,10 @@ TclParseNumber(
objPtr->typePtr = &tclIntType;
if (signum) {
objPtr->internalRep.wideValue =
- - (Tcl_WideInt) significandWide;
+ (Tcl_WideInt)(-significandWide);
} else {
objPtr->internalRep.wideValue =
- (Tcl_WideInt) significandWide;
+ (Tcl_WideInt)significandWide;
}
}
}
@@ -2122,7 +2122,7 @@ RefineApproximation(
*/
if (roundToEven) {
rteSignificand = frexp(approxResult, &rteExponent);
- rteSigWide = (Tcl_WideInt) ldexp(rteSignificand, FP_PRECISION);
+ rteSigWide = (Tcl_WideInt)ldexp(rteSignificand, FP_PRECISION);
if ((rteSigWide & 1) == 0) {
mp_clear(&twoMd);
mp_clear(&twoMv);
@@ -4784,7 +4784,7 @@ Tcl_InitBignumFromDouble(
err = mp_init(b);
mp_zero(b);
} else {
- Tcl_WideInt w = (Tcl_WideInt) ldexp(fract, mantBits);
+ Tcl_WideInt w = (Tcl_WideInt)ldexp(fract, mantBits);
int shift = expt - mantBits;
err = mp_init_i64(b, w);