JIT: don't rely on undefined behavior for constant overflow checking

I have no idea what the compiler does with these, and this code probably
isn't triggered in most games, but it's probably better not to taunt the
undefined behavior demon.
Merge pull request #812 from FioraAeterna/fixundefined

JIT: don't rely on undefined behavior for constant overflow checking