SpacemanDMM
SpacemanDMM copied to clipboard
constant folding still has some issues regarding overflows
related: https://github.com/SpaceManiac/SpacemanDMM/commit/90d81ddbf74c6c637e9224f056eb2256f3eed6a8
Code:
#define TEST 2147483647 + 1 + 1073741824 + 1073741824
#if TEST
/world/New()
world.log << "Good"
#else
"poop"
#endif
Release builds of DreamChecker evaluates TEST to 0
when it should be 4294967296
, and so hits a compile error. Debug builds will just panic thanks to rust, so it's pretty easy to test for.
My first instinct is that this could be solved by using float arithmetic for all constant folding and then converting back to integers if desired.
My first instinct is that this could be solved by using float arithmetic for all constant folding and then converting back to integers if desired.
Ultimately having a Constant::Int
separate from Constant::Float
does not reflect the reality of DM, so it should be eliminated.
I think this was fixed in ce0345efc07d082108b712b283c73bd909895a7b