Morton Save

Project README

Morton

This repository implements bit interleaving in C/C++.

 morton(0b1100,0b0011)
          │││└──┐││││
          ││└─┐ │││││
          │└┐ │ │││││
          │┌─────┘│││
          │││ │ │ │││
          │││┌────┘││
          │││││ │  ││
          │││││┌───┘│
          │││││││┌──┘
        0b10100101

By default a SWAR implementation is used which takes 2 nanoseconds. If -mbmi2 is available, then morton() and unmorton() take less than one nanosecond. If no compiler optimizations are used then these funcs take 10 nanoseconds. The cost is constant since this implementation is fully branchless.

See Also

Open Source Agenda is not affiliated with "Morton" Project. README Source: jart/morton
Stars
271
Open Issues
1
Last Commit
1 week ago
Repository
License
ISC

Open Source Agenda Badge

Open Source Agenda Rating