Returns the index of the first different bit or -1 if the values are the same.

def _bit_mismatch(int1: int, int2: int) -> int:
    """Returns the index of the first different bit or -1 if the values are the same."""
    for i in range(max(int1.bit_length(), int2.bit_length())):
        if (int1 >> i) & 1 != (int2 >> i) & 1:
            return i
    return -1