Exemplo n.º 1
0
def int_list_to_array(input):
    length = len(input)
    if length == 0:
        return CPX.cvar.CPX_NULL
    output = CPX.intArray(length)
    for i in range(length):
        output[i] = input[i]
    return output
def int_list_to_array(input):
    length = len(input)
    if length == 0:
        return CPX.cvar.CPX_NULL
    output = CPX.intArray(length)
    for i in range(length):
        output[i] = input[i]
    return output
Exemplo n.º 3
0
def int_list_to_array_trunc_int32(input):
    int32_min = -2147483648
    int32_max = 2147483647
    length = len(input)
    if length == 0:
        return CPX.cvar.CPX_NULL
    output = CPX.intArray(length)
    for i in range(length):
        if input[i] > int32_max:
            output[i] = int32_max
        elif input[i] < int32_min:
            output[i] = int32_min
        else:
            output[i] = input[i]
    return output
def int_list_to_array_trunc_int32(input):
    int32_min = -2147483648
    int32_max =  2147483647
    length = len(input)
    if length == 0:
        return CPX.cvar.CPX_NULL
    output = CPX.intArray(length)
    for i in range(length):
        if input[i] > int32_max:
            output[i] = int32_max
        elif input[i] < int32_min:
            output[i] = int32_min
        else:
            output[i] = input[i]
    return output