Tuesday, November 18, 2008

How to count number of bits set in a DWORD

This small function is very useful in the industrial automation field and any low level program in C/C++. You also can find the exactly same one on the Internet. Here I would like to share one of the widely used function, and it's complexity. I will post more algorithms later and do a comparison.
Complexity : O(n) Where n = number of bits set in the DWORD actually.

No comments: