Morton encoding/decoding through bit interleaving: Implementations
UPDATE 2016: I’ve bundled and improved a lot of these methods in a library called libmorton. Read about it here. The code used in this post is outdated and might have bugs. Keeping this post online for reference, but I highly suggest using libmorton for actual implementations. In my research …