Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned long long rotateLeft( unsigned long long bs )
- {
- return ( ( bs & 0x0000000000001111 ) << 48 ) |
- ( ( bs & 0x0000000000002222 ) << 31 ) |
- ( ( bs & 0x0000000000004444 ) << 14 ) |
- ( ( bs & 0x0000000000008888 ) >> 3 ) |
- ( ( bs & 0x0000000011110000 ) << 33 ) |
- ( ( bs & 0x0000000022220000 ) << 16 ) |
- ( ( bs & 0x0000000044440000 ) >> 1 ) |
- ( ( bs & 0x0000000088880000 ) >> 18 ) |
- ( ( bs & 0x0000111100000000 ) << 18 ) |
- ( ( bs & 0x0000222200000000 ) << 1 ) |
- ( ( bs & 0x0000444400000000 ) >> 16 ) |
- ( ( bs & 0x0000888800000000 ) >> 33 ) |
- ( ( bs & 0x1111000000000000 ) << 3 ) |
- ( ( bs & 0x2222000000000000 ) >> 14 ) |
- ( ( bs & 0x4444000000000000 ) >> 31 ) |
- ( ( bs & 0x8888000000000000 ) >> 48 );
- }
- unsigned long long rotateLeft( unsigned long long bs )
- {
- //mirror in diagonal plane (x=z?)
- bs = ( ( bs & 0x0000000000008888 ) << 45 ) | ( ( bs & 0x1111000000000000 ) >> 45 ) |
- ( ( bs & 0x0000000088884444 ) << 30 ) | ( ( bs & 0x2222111100000000 ) >> 30 ) |
- ( ( bs & 0x0000888844442222 ) << 15 ) | ( ( bs & 0x4444222211110000 ) >> 15 ) |
- ( bs & 0x8888444422221111 );
- //mirror in vertical plane (xy?)
- //I do apologize for not knowing the correct terminology.
- bs = ( ( bs & 0x00000000ffffffff ) << 32 ) | ( ( bs & 0xffffffff00000000 ) >> 32 );
- return ( ( bs & 0x0000ffff0000ffff ) << 16 ) | ( ( bs & 0xffff0000ffff0000 ) >> 16 ) |
- }
Add Comment
Please, Sign In to add comment