tags:

views:

83

answers:

1

Can I make a function int bitParity(int x) that returns 1 if x contains an odd number of 0's using only these operators? ! ~ & ^ | + << >>

+2  A: 

Hey, it was exactly three clicks. google -> 1.st result - wiki/Parity_bit -> external link -> http://graphics.stanford.edu/~seander/bithacks.html#ParityNaive

Krab