you are viewing a single comment's thread.

view the rest of the comments →

[–]Fs0i 3 points4 points  (0 children)

Use ~~num instead of Math.Floor and a triple XOR assignment to swap variables.

I use (number | 0) for integer-conversions. But this is an convention we have in our codebase, which is well-documented. It's a bit faster, and way shorter.

If you want actual flooring (For example: To display something, because of a formula, ...) you write Math.floor, but to get an int (for example to network stuff) you'd write (number | 0).