Morton: Bit Interleaving in C/C++

This repository implements bit interleaving in C/C++ using the ISC license. A SWAR implementation is used by default, taking 2 nanoseconds. With -mbmi2 available, the functions morton() and unmorton() take less than one nanosecond. Without compiler optimizations, these functions take 10 nanoseconds, but the cost is constant as the implementation is fully branchless. Additional resources for further reading are provided, including links to Z-order curve and bithacks information. The repository has 183 stars and 5 forks on GitHub, with activity focused on C language development.

https://github.com/jart/morton

To top