|
2018-09-04
| ||
| 14:38 | • Closed ticket [540bed4bde]: binary format can result in "integer value too ... artifact: 19ebb2678d user: jan.nijtmans | |
| 14:37 | Fix [540bed4bde]: binary format can result in "integer value too large to represent". Implemented a... check-in: c531497fcb user: jan.nijtmans tags: core-8-branch | |
| 14:28 | • New ticket [540bed4bde] binary format can result in "integer value too larg... artifact: 2bbf571dde user: jan.nijtmans | |
binary format can result in "integer value too large to represent"
Closed / Fixed540bed4bde5128aa035465946ff9c520cd79e1c1Created 8 years agoUpdated 8 years ago
Descriptionwiki2018-09-04 14:28:03
Example:
% string length [binary format w [expr {(wide(3) << 31) + (wide(3) << 64)}]]
integer value too large to represent
According to the documentation "binary format w" takes the least significant 64 bits from the given integer. Since Tcl has bignums, it should be able to do that, but this was never implemented for "binary format".
Expected:
% string length [binary format w [expr {(wide(3) << 31) + (wide(3) << 64)}]]
8
(since 64 bits always result in 8 bytes)
Referenced by1
c531497fcbFix [540bed4bde]: binary format can result in "integer value too large to represent". Implemented a new utility function TclGetWideBitsFromObj(), which handles the overflowing of integers using bignums. This function can be used in a _LOT_ of other places, preventing code duplication. Done that as well. Those changes have no effect on other commands, only two new "binary format" test-cases for this specific situation: binary-44.5 and binary-44.6 check-in2018-09-04 14:37:01
jan.nijtmansplain2018-09-04 14:38:55
Fixed for 8.7. Not really important enough to fix for 8.6 too, since then it needs to be done for both "int" and "wideInt". So, backporting is not 100% trivial.
Log in (anonymous is fine) to add a comment.