How would i go about finding the number of \'zero\' bits in C++. Suppose I have an integer;
int value = 276;
For which I have the bits 100010
I'm surprised no one has mentioned this one:
int num_zero_bits = __builtin_popcount(~num);
This will give the number of zero bits in num when used with GCC.
num