Nofew

Weird C code

Jun 12th, 2011
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
  2. #define BX_(x) ((x) - (((x)>>1)&0x77777777) \
  3. - (((x)>>2)&0x33333333) \
  4. - (((x)>>3)&0x11111111))
  5. -- really weird C code to count the number of bits in a word
Advertisement
Add Comment
Please, Sign In to add comment