Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint64_t ccSpaceCurveMap3D21Bits64( uint64_t *point )
- {
- int bit, rotation;
- uint64_t curveindex, pointindex, indexpart;
- uint64_t addmask, addbits;
- pointindex = point[2] ^ ( point[2] >> 1 );
- pointindex <<= 21;
- pointindex |= point[1] ^ ( point[1] >> 1 );
- pointindex <<= 21;
- pointindex |= point[0] ^ ( point[0] >> 1 );
- rotation = 0;
- addmask = 0;
- curveindex = 0;
- bit = 20;
- do
- {
- indexpart = pointindex >> bit;
- addmask ^= ( indexpart & 0x1 ) | ( ( indexpart >> 20 ) & 0x2 ) | ( ( indexpart >> 40 ) & 0x4 );
- addbits = ( ( addmask >> rotation ) | ( addmask << ( 3 - rotation ) ) ) & 0x7;
- curveindex = ( curveindex << 3 ) | addbits;
- addmask = 1 << rotation;
- rotation = ( 0x641289 >> ( ( ( addbits & 0x3 ) << 1 ) | ( rotation << 3 ) ) ) & 0x3;
- } while( --bit >= 0 );
- curveindex ^= (uint64_t)0x924924924924924;
- for( bit = 1 ; bit < 63 ; bit <<= 1 )
- curveindex ^= curveindex >> bit;
- return curveindex;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement