Parity will store the count of set bits
parity = 0 NEW_LINE while ( x != 0 ) : NEW_LINE INDENT if ( x & 1 ) : NEW_LINE INDENT parity += 1 NEW_LINE DEDENT x = x >> 1 NEW_LINE DEDENT return parity NEW_LINE