def int_to_signed_byte(x):
    """
    Converts the signed integer to a 2s-complement byte.
    """
    if x > 0:
        return x & 0xff
    elif x < 0:
        return ((-x) ^ 0xff) + 1
    else:
        return 0