def int32(x):
    """Force conversion of x to 32-bit signed integer"""
    x = int(x)
    maxint = int(2**31-1)
    minint = int(-2**31)
    if x > maxint: x = maxint
    if x < minint: x = minint
    return x