Advertisement
Zeda

mod6.c

Jul 20th, 2019
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. uint32_t mod6(uint32_t x){
  2.     uint32_t y,t;
  3.     t=x&1;
  4.     x>>=1;
  5.  
  6.     y  = x&0xFFFF;
  7.     x ^= y;
  8.     x>>= 16;
  9.     x += y;
  10.     x += (x>>16);
  11.     x &= 0xFFFF;
  12.  
  13.     y  = x&0xFF;
  14.     x ^= y;
  15.     x>>= 8;
  16.     x += y;
  17.     x += (x>>8);
  18.     x &= 0xFF;
  19.  
  20.     y  = x&0xF;
  21.     x ^= y;
  22.     x>>= 4;
  23.     x += y;
  24.     x += (x>>4);
  25.     x &= 0xF;
  26.  
  27.     y  = x&0x3;
  28.     x ^= y;
  29.     x>>= 2;
  30.     x += y;
  31.     x += (x>>2);
  32.     x &= 0x3;
  33.  
  34.     y  = x+1;
  35.     y &= 4;
  36.     x += x + t;
  37.     x -= (y + (y>>1));
  38.    
  39.     return x;
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement