Finding out no bits set in a variable in faster manner
Possible Duplicate:
Best algorithm to count the number of set bits in a 32-bit integer?
Finding out the no. bits sets in a variable is easier. But how could we perform the same operation in fastest method ?
关于Bit Twiddling Hacks的这个页面涵盖了几种技术来计算设置的位数,并讨论了每种技术的性能。
有点唠叨的黑客页面有各种各样的建议。
I highly recommend reading Hacker's Delight for all questions regarding various forms of bit-twiddling. For counting bits, in particular, it analyzes several algorithms depending on the instructions you might have available to you.
链接地址: http://www.djcxy.com/p/72592.html上一篇: 如何计算c中没有循环的字节数?
下一篇: 以更快的方式找出变量中没有设置的位