Bit Manipulation Flashcards

1
Q

Count number of bits set

A

And a number with n-1 makes the rightmost 1 to 0. So in a loop do it ..assign the result to n untill n becomes 0. Increment counts every time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly