3 ms·
> If you know a few tricks, like how to let the VM know you want integer math [1] > [1] Add | 0 after every math operation to get a 32-bit signed integer resul
by solardev 4y ago
> If you know a few tricks, like how to let the VM know you want integer math [1]
> [1] Add | 0 after every math operation to get a 32-bit signed integer result, and >>> 0 for a 32-bit unsigned integer result.
That's definitely gonna cause a few "wtf?" moments for everyone else on your team, lol
- modeless 4y agoYeah, you shouldn't do it all over the place prophylactically. It's a technique for optimizing functions that are performance critical. Although I find `| 0` surprisingly well known these days. I sometimes use it in places where I want a cast to integer.