Interesting tit-bits from fortune ..

Apr 08, 2009 19:30



#define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255)
#define BX_(x) ((x) - (((x)>>1)&0x77777777) \
- (((x)>>2)&0x33333333) \
- (((x)>>3)&0x11111111))

-- really weird C code to count the number of bits in a word

Leave a comment

Comments 3

icklemichael April 8 2009, 18:46:34 UTC
If you like random code for slightly random things I recommend:

http://www.amazon.co.uk/Hackers-Delight-Henry-S-Warren/dp/0201914654/ref=sr_1_1?ie=UTF8&s=books&qid=1239216289&sr=8-1

I would lend it to you but I'd probably never see it again! ;)

Reply

zaniyah April 9 2009, 11:56:26 UTC
I still have your book! I have just not had a chance to see you when I had it with me. :(

Reply

zaniyah April 9 2009, 12:21:54 UTC
Also, that book looks awesome ..

Reply


Leave a comment

Up