Unsigned integer constants
I encountered an issue where:
- 32-bit ABC code is interpreted on a 64-bit platform (e.g. compile with 32-bit Clean, run in WebAssembly)
- The code uses negative integer constants with unsigned semantics (e.g.
bitor 0x80000000
)
When generating 64-bit bytecode this value is sign-extended, since there is no way to tell that this value should be 0x0000000080000000
on 64-bit platforms.
The issue could be solved by computing the values at runtime (https://gitlab.science.ru.nl/clean-and-itasks/clean-platform/-/merge_requests/386) using only positive values. Performance-wise this is not ideal.
Would it be very difficult to add syntax for unsigned integer constants, e.g. 0x80000000u
or 0ux80000000
(neither of these is fully backwards compatible) all the way down to the ABC level so that the bytecode generator knows how the value should be extended? Or do you see another way to solve this without losing performance?