summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclUtil.c11
-rw-r--r--tests/util.test6
2 files changed, 1 insertions, 16 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index e90477f..9557aac 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3585,16 +3585,7 @@ TclGetIntForIndex(
* be converted to one, use it.
*/
- Tcl_WideInt value = endValue + objPtr->internalRep.wideValue;
- if (endValue > 0 && value < objPtr->internalRep.wideValue) {
- *indexPtr = INT_MAX; /* numerical overflow */
- } else if (value < INT_MIN || (endValue < 0 && value > objPtr->internalRep.wideValue)) {
- *indexPtr = INT_MIN; /* numerical underflow or value < INT_MIN */
- } else if (value > INT_MAX) {
- *indexPtr = INT_MAX;/* value > INT_MAX */
- } else {
- *indexPtr = (int) value;
- }
+ *indexPtr = endValue + (int)objPtr->internalRep.wideValue;
return TCL_OK;
}
diff --git a/tests/util.test b/tests/util.test
index d186523..35fc642 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -729,12 +729,6 @@ test util-9.43 {TclGetIntForIndex} -body {
test util-9.44 {TclGetIntForIndex} -body {
string index a 0+1000000000000
} -returnCodes error -match glob -result *
-test util-9.45 {TclGetIntForIndex} {
- string index abcd end+2305843009213693950
-} {}
-test util-9.46 {TclGetIntForIndex} {
- string index abcd end+4294967294
-} {}
test util-10.1 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x0000000000000000