pastojs: Fixed arithmetic for simple integer types
Summary
Fixed arithmetic for simple integer types
What is the behavior after applying this patch?
- replaced rtl.lw() function (longword fix function) with "value >>> 0" operation
- fixed "not" operation for byte, word, shortint, smallint types
- added integer overflow "emulation" for byte, word, shortint, smallint, longword, longint types for arithmetic operations
- fixed integer type resolve for arithmetic operations for byte, word, shortint, smallint types and mixed expressions For example: byte + byte should be resolved to longint, currently it is byte
- fixed assignment of different integer types For example: a : byte := b : Integer; => "a = b & 255"
- different optimizations that taking into account parent expression and applies integer overflow "emulation" only when needed.
Relevant logs and/or screenshots
MathTest.pas This simple test shows expressions that resolved/calculated incorrectly in the current version and fixed by this patch.