JIT64: various integer optimizations

These two functions should probably go to MathUtil (there already are some other ones that seem quite similar).