Skip to content

jart/morton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published