Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example ```cpp /// Must be compiled with -fsanitze=undefined #include <iostream> #include <stdio.h> long long _InterleaveBits( int p[3] ) { long long key = 0; for( int i=0 ; i<32 ; i++ ) { key |= ( ( p[0] & (1<<i) )<<(2*i) ) | ( ( p[1] & (1<<i) )<<(2*i+1) ) | ( ( p[2] & (1<<i) )<<(2*i+2) ); } return key; } long long _FixedInterleaveBits( int _p[3] ) { long long key = 0; long long p[3] = {_p[0],_p[1],_p[2]}; for( int i=0 ; i<31 ; i++ ) { key |= ( ( p[0] & (1ull<<i) )<<(2*i) ) | ( ( p[1] & (1ull<<i) )<<(2*i+1) ) | ( ( p[2] & (1ull<<i) )<<(2*i+2) ); } return key; } int main() { int p[3] = {0,255,128}; std::cout << _InterleaveBits(p) << std::endl; std::cout << _FixedInterleaveBits(p) << std::endl; } ```
- Loading branch information