summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-16 16:52:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-16 16:52:52 (GMT)
commitd36751c671764d5351700a2ca73e18f78bd6aae8 (patch)
treeb23d01d9c62430861484d209b16f06346ba443ab
parent8fc3f4f2157ac13b2ae1ecd90329697069d33b27 (diff)
parentc9599e745ab10316ab4bb48c8d129ce9f5cee15b (diff)
downloadtcl-d36751c671764d5351700a2ca73e18f78bd6aae8.zip
tcl-d36751c671764d5351700a2ca73e18f78bd6aae8.tar.gz
tcl-d36751c671764d5351700a2ca73e18f78bd6aae8.tar.bz2
Merge 8.6
-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 bfb094a..403f3c9 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1857,7 +1857,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.
@@ -3711,7 +3711,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
@@ -6111,7 +6111,7 @@ TEBCresume(
switch (*pc) {
case INST_ADD:
- wResult = w1 + w2;
+ wResult = (Tcl_WideInt)((Tcl_WideUInt)w1 + (Tcl_WideUInt)w2);
/*
* Check for overflow.
*/
@@ -6122,7 +6122,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
@@ -7529,20 +7529,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#");
@@ -7802,7 +7802,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);
@@ -8148,12 +8148,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);
@@ -8162,7 +8162,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.
*/
@@ -8432,7 +8432,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);
@@ -8522,8 +8522,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;
}
@@ -8534,8 +8534,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;
}
@@ -8666,7 +8666,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))
{
/*
@@ -8680,7 +8680,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))
{
/*
@@ -8906,7 +8906,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;
}
@@ -8929,7 +8929,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);
@@ -8954,7 +8954,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) {
@@ -8963,7 +8963,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 16a95cd..4ac9936 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3054,7 +3054,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;
@@ -3090,12 +3090,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;
}
}
@@ -3329,12 +3329,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;
}
}
@@ -3800,7 +3800,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 e87f714..32e6701 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -1447,10 +1447,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;
}
}
}
@@ -1483,10 +1483,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;
}
}
}
@@ -2189,7 +2189,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);
@@ -4852,7 +4852,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);