Low Level Bit Hacks You Absolutely Must Know - good coders code, great reuse
http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/
good coders code, great reuse2009-07-04 - 当面C#と.NETな記録
一番右端の立っているビット位置を求める「ものすごい」コード
うーん全然わかんねー…
crazy!Puzzle: Fast Bit Counting « Reflections
return ((tmp + (tmp >> 3)) & 030707070707) % 63;bithacks.h - bit hacks header file - good coders code, great reuse
This header file is called “bithacks.h” and it contains various macros for bit manipulations. I also wrote tests for all the macros in the “bithacks-test.c” program. The most beautiful part of “bithacks.h” is the “B8” macro that allows to write something like ” x = B8(10101010) ” and turns it into ” x = 170 ” (because 10101010 in binary is 170 in decimal). I have not yet added B16 and B32 macros but I will add them when I publish the article on advanced bithacks. The credit for the B8 idea goes to Tom Torfs who was the first to write it.the bit twiddler
一些有用的代码收集
Frammenti di codice C per trucchetti
the bit twiddler