diff options
| -rw-r--r-- | generic/tcl.h | 8 | ||||
| -rw-r--r-- | generic/tclExecute.c | 6 | ||||
| -rw-r--r-- | tests/expr.test | 1 |
3 files changed, 7 insertions, 8 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 83dfa27..d0636ce 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2223,11 +2223,9 @@ typedef struct Tcl_EncodingType { /* * The maximum number of bytes that are necessary to represent a single - * Unicode character in UTF-8. The valid values are 3 and 4 - * (or perhaps 1 if we want to support a non-unicode enabled core). If 3, - * then Tcl_UniChar must be 2-bytes in size (UTF-16) (the default). If > 3, - * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UTF-16 mode - * is the default and recommended mode. + * Unicode character in UTF-8. The valid values are 3 and 4. If > 3, + * then Tcl_UniChar must be 4-bytes in size (UCS-4) (the default for the + * Tcl core). If == 3, then Tcl_UniChar must be 2-bytes in size (UTF-16). */ #ifndef TCL_UTF_MAX diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 674406c..cb12975 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -6081,7 +6081,7 @@ TEBCresume( * Quickly force large right shifts to 0 or -1. */ - if (w2 >= (Tcl_WideInt)(CHAR_BIT*sizeof(long))) { + if (w2 >= (Tcl_WideInt)(CHAR_BIT*sizeof(w1))) { /* * We assume that INT_MAX is much larger than the * number of bits in a long. This is a pretty safe @@ -6149,9 +6149,9 @@ TEBCresume( * Handle shifts within the native long range. */ - if (((size_t)shift < CHAR_BIT*sizeof(long)) + if (((size_t)shift < CHAR_BIT*sizeof(w1)) && !((w1>0 ? w1 : ~w1) & - -(1UL<<(CHAR_BIT*sizeof(long) - 1 - shift)))) { + -(1UL<<(CHAR_BIT*sizeof(w1) - 1 - shift)))) { wResult = (Tcl_WideUInt)w1 << shift; goto wideResultOfArithmetic; } diff --git a/tests/expr.test b/tests/expr.test index b0790e6a..6b7dbf5 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -1428,6 +1428,7 @@ test expr-24.8 {expr edge cases; shifting} {expr wide(10<<63)} 0 test expr-24.9 {expr edge cases; shifting} {expr 5>>32} 0 test expr-24.10 {INST_LSHIFT: Bug 1567222} {expr 500000000000000<<28} 134217728000000000000000 +test expr-24.11 {INST_LSHIFT: Bug 84a5355235} {expr -549755813888>>32} -128 # List membership tests test expr-25.1 {'in' operator} {expr {"a" in "a b c"}} 1 |
