8
So I'm trying to see if there's some sneaky series of bit operations that will allow me to count how many bits in a uint32 are 1 (or rather the count mod 2).
The "obvious" way would be something like this:
uint32 count_1_bits_mod_2(uint32 word) {
uint32 i, sum_mod_2;
for(i = 0; i < 32; i++)
sum_mod_2 ^= word;
word >>= 1;
Is there some "sneaky" way to get the proper sum_mod_2 without using a loop?