summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-05-31 13:21:27 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-05-31 13:21:27 (GMT)
commit04696b538d50c932db9d41367cc26ca0ec850ac5 (patch)
tree5b459bb2847901494a56ed821e3df528f0cc401c
parentc9afb464febe0fe845445fea2fab4ea2e452988b (diff)
downloadtcl-04696b538d50c932db9d41367cc26ca0ec850ac5.zip
tcl-04696b538d50c932db9d41367cc26ca0ec850ac5.tar.gz
tcl-04696b538d50c932db9d41367cc26ca0ec850ac5.tar.bz2
Make last test-cases pass
-rw-r--r--generic/tclScan.c16
-rw-r--r--tests/expr.test2
-rw-r--r--tests/obj.test11
-rw-r--r--tests/scan.test3
4 files changed, 9 insertions, 23 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index ca27f77..e4511bf 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -605,7 +605,7 @@ Tcl_ScanObjCmd(
const char *format;
int numVars, nconversions, totalVars = -1;
int objIndex, offset, i, result, code;
- long value;
+ int value;
const char *string, *end, *baseString;
char op = 0;
int underflow = 0;
@@ -1006,19 +1006,7 @@ Tcl_ScanObjCmd(
}
}
if ((flags & SCAN_UNSIGNED) && (value < 0)) {
-#ifdef TCL_WIDE_INT_IS_LONG
- mp_int big;
- if (mp_init_u64(&big, (unsigned long)value) != MP_OKAY) {
- Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "insufficient memory to create bignum", -1));
- Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL);
- return TCL_ERROR;
- } else {
- Tcl_SetBignumObj(objPtr, &big);
- }
-#else
- Tcl_SetWideIntObj(objPtr, (unsigned long)value);
-#endif
+ Tcl_SetWideIntObj(objPtr, (unsigned int)value);
} else {
TclSetIntObj(objPtr, value);
}
diff --git a/tests/expr.test b/tests/expr.test
index f2c7ae6..bfefde3 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -5842,7 +5842,7 @@ test expr-33.1 {parse largest long value} {
[expr {int(2147483647 + 1) > 0}] \
} {2147483647 2147483647 2147483647 2147483647 1 1}
-test expr-33.2 {parse smallest long value} longIs32bit {
+test expr-33.2 {parse smallest long value} {
set min_long_str -2147483648
set min_long_hex "-0x80000000 "
diff --git a/tests/obj.test b/tests/obj.test
index eb85c84..fcd8d89 100644
--- a/tests/obj.test
+++ b/tests/obj.test
@@ -20,7 +20,6 @@ if {"::tcltest" ni [namespace children]} {
catch [list package require -exact tcl::test [info patchlevel]]
testConstraint testobj [llength [info commands testobj]]
-testConstraint longIs32bit [expr {$tcl_platform(wordSize) == 4}]
testConstraint wideIs64bit [expr {wide(0x8000000000000000) < 0}]
test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} testobj {
@@ -547,11 +546,11 @@ test obj-32.1 {freeing very large object trees} {
unset x
} {}
-test obj-33.1 {integer overflow on input} {longIs32bit wideIs64bit} {
+test obj-33.1 {integer overflow on input} {wideIs64bit} {
set x 0x8000; append x 0000
list [string is integer $x] [expr { wide($x) }]
} {1 2147483648}
-test obj-33.2 {integer overflow on input} {longIs32bit wideIs64bit} {
+test obj-33.2 {integer overflow on input} {wideIs64bit} {
set x 0xffff; append x ffff
list [string is integer $x] [expr { wide($x) }]
} {1 4294967295}
@@ -559,15 +558,15 @@ test obj-33.3 {integer overflow on input} {
set x 0x10000; append x 0000
list [string is integer $x] [expr { wide($x) }]
} {1 4294967296}
-test obj-33.4 {integer overflow on input} {longIs32bit wideIs64bit} {
+test obj-33.4 {integer overflow on input} {wideIs64bit} {
set x -0x8000; append x 0000
list [string is integer $x] [expr { wide($x) }]
} {1 -2147483648}
-test obj-33.5 {integer overflow on input} {longIs32bit wideIs64bit} {
+test obj-33.5 {integer overflow on input} {wideIs64bit} {
set x -0x8000; append x 0001
list [string is integer $x] [expr { wide($x) }]
} {1 -2147483649}
-test obj-33.6 {integer overflow on input} {longIs32bit wideIs64bit} {
+test obj-33.6 {integer overflow on input} {wideIs64bit} {
set x -0xffff; append x ffff
list [string is integer $x] [expr { wide($x) }]
} {1 -4294967295}
diff --git a/tests/scan.test b/tests/scan.test
index 6d7a9fb..6d91c8d 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -82,7 +82,6 @@ proc testIEEE {} {
}
testConstraint ieeeFloatingPoint [testIEEE]
-testConstraint wideIs64bit [expr {wide(0x8000000000000000) < 0}]
test scan-1.1 {BuildCharSet, CharInSet} {
list [scan foo {%[^o]} x] $x
@@ -517,7 +516,7 @@ test scan-5.11 {integer scanning} -constraints {nonPortable} -setup {
list [scan "4294967280 4294967280" "%u %d" a b] $a \
[expr {$b == -16 || $b == 0x7fffffff}]
} -result {2 4294967280 1}
-test scan-5.12 {integer scanning} -constraints {wideIs64bit} -setup {
+test scan-5.12 {integer scanning} -setup {
set a {}; set b {}; set c {}
} -body {
list [scan "7810179016327718216,6c63546f6c6c6548,661432506755433062510" \