So once you see what number &= number - 1
is, doing the problem is trivial. Here's a binary example:
first pass
1001001 - 1 = 1001000
1001001 & 1001000 = 1001000
second pass
1001000 - 1 = 1000111
1001000 & 1000111 = 1000000
third pass
1000000 - 1 = 111111
1000000 & 111111 = 0
Note that the number of passes it takes to turn the number into zero, is equivalent to the number of set bits, because you remove one set bit each pass. Parity is the number (or sum) of set bits modulo 2. Modulo 2 addition is the xor operation, hence the use of xor in the algorithm to find the parity.