I have a simple method.
Let hash[x]=count of 1 bits in x for 0<=x<2^16
So for any 32-bit integer x, the count of 1 bits is hash[x&0xffff]
+hash[x>>16].
We can pre-calculate all hash[] value.

On Mar 21, 1:24 pm, "hijkl" <[EMAIL PROTECTED]> wrote:
> How to count the 1 bits in a integer?
>     int Count1Bits(int i);
>     How about this function is used very often?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to