Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint32_t mod6(uint32_t x){
- uint32_t y,t;
- t=x&1;
- x>>=1;
- y = x&0xFFFF;
- x ^= y;
- x>>= 16;
- x += y;
- x += (x>>16);
- x &= 0xFFFF;
- y = x&0xFF;
- x ^= y;
- x>>= 8;
- x += y;
- x += (x>>8);
- x &= 0xFF;
- y = x&0xF;
- x ^= y;
- x>>= 4;
- x += y;
- x += (x>>4);
- x &= 0xF;
- y = x&0x3;
- x ^= y;
- x>>= 2;
- x += y;
- x += (x>>2);
- x &= 0x3;
- y = x+1;
- y &= 4;
- x += x + t;
- x -= (y + (y>>1));
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement