If you have to count numbers of 1 in a 32 bit word. Other than checking every other bit or dividing the bits is 4 parts and then using lookup table. What will be some other most efficent way ?

Recommended Answers

All 3 Replies

If you have to count numbers of 1 in a 32 bit word. Other than checking every other bit or dividing the bits is 4 parts and then using lookup table. What will be some other most efficent way ?

You're ruling out these?

commented: fun link :-) -Raye +1

If you have to count numbers of 1 in a 32 bit word. Other than checking every other bit or dividing the bits is 4 parts and then using lookup table. What will be some other most efficent way ?

Jeez... do your own 'Computer Systems' Homework!

If you have to count numbers of 1 in a 32 bit word. Other than checking every other bit or dividing the bits is 4 parts and then using lookup table. What will be some other most efficent way ?

Can you show an example of what you need to do? I'm assuming you just want to count the number of set bits in a word, but it might be something different than that.

Jeez... do your own 'Computer Systems' Homework!

mehakkapur included a viable solution in his question, so this isn't a matter of not knowing how to solve the problem. He also didn't ask for code, so assuming that this is the usual homework question is jumping the gun. Not to mention that the way you went about that assumption was rude and uncalled for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.