Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of floats when calculating chunk position from block position. This can be done in integers. Since CHUNK_WIDTH etc. are guaranteed to be powers of two, using & -N is equivalent to doing & ~(N-1), or put differently, making it divisible by N. That makes the division exact, and allows the compiler to transform it into a plain shift (tested with both gcc and clang). We did the same in Part 3 of this series.
- Loading branch information