Files
wren/test/language/number/hex_literals.wren
T
Bob Nystrom 1b635d029a fix: replace strtol with strtoll for 64-bit hex literal parsing on 32-bit platforms
The previous implementation used strtol() for parsing hex literals, which only supports up to 32-bit values on 32-bit architectures. This caused hex literals larger than 0x7FFFFFFF to overflow or fail. Changed to strtoll() which guarantees 64-bit parsing regardless of platform word size.

Also updated the error message to include the actual sizeof(long int) for debugging, uncommented the previously disabled 64-bit hex literal examples in syntax.wren, and added a test case for 0xdeadbeef to verify the fix works correctly.
2017-01-13 05:53:21 +00:00

10 lines
283 B
Plaintext

var x = 0xFF
System.print(x) // expect: 255
System.print(x + 1) // expect: 256
System.print(x == 255) // expect: true
System.print(0x09 is Num) // expect: true
System.print(x is Num) // expect: true
System.print(-0xFF) // expect: -255
System.print(0xdeadbeef) // expect: 3735928559