def uint2int64(value):
    """
    Convert an unsigned 64 bits integer into a signed 64 bits integer.

    >>> print(uint2int64(1))
    1
    >>> print(uint2int64(2**64 + 1))  # ignore bits larger than 64 bits
    1
    >>> print(uint2int64(18446744073709551615))
    -1
    >>> print(uint2int64(18446744073709551614))
    -2
    """
    value = value & 0xffffffffffffffff
    if value & 0x8000000000000000:
        return value - 0x10000000000000000
    else:
        return value