Possible Duplicate:
Best algorithm to count the number of set bits in a 32-bit integer?
This is a nice one:
What is the the most efficient way you know (in C) to count how many bits are set in a word?
In case of 8bit, you can use lookup table, but what about 128bit? more?