Can someone explain to me how this function works? I understand the drop the lowest set of a bit of x part which is the 5th line but I don't understand the assignment result ^= 1; Shouldn't result be counting 0 and 1 when deciding parity of a word?
short Parity_of_word(unsigned long long x) {
short result = 0;
while(x) {
result ^= 1;
x &= (x-1);
}
return result;
}