示例#1
0
def int_floordiv_zer(x, y):
    '''#define OP_INT_FLOORDIV_ZER(x,y,r,err) \
        if ((y)) { OP_INT_FLOORDIV(x,y,r,err); } \
        else FAIL_ZER(err, "integer division")
    '''
    if y:
        return llop.int_floordiv(Signed, x, y)
    else:
        raise ZeroDivisionError("integer division")
示例#2
0
def int_floordiv_zer(x, y):
    '''#define OP_INT_FLOORDIV_ZER(x,y,r,err) \
        if ((y)) { OP_INT_FLOORDIV(x,y,r,err); } \
        else FAIL_ZER(err, "integer division")
    '''
    if y:
        return llop.int_floordiv(Signed, x, y)
    else:
        raise ZeroDivisionError("integer division")
示例#3
0
def int_floordiv_ovf(x, y):
    '''#define OP_INT_FLOORDIV_OVF(x,y,r,err) \
        if ((y) == -1 && (x) < 0 && ((unsigned long)(x) << 1) == 0) \
                FAIL_OVF(err, "integer division"); \
        OP_INT_FLOORDIV(x,y,r,err)
    '''
    if y == -1 and x < 0 and (r_uint(x) << 1) == 0:
        raise OverflowError("integer division")
    else:
        return llop.int_floordiv(Signed, x, y)
示例#4
0
def int_floordiv_ovf(x, y):
    '''#define OP_INT_FLOORDIV_OVF(x,y,r,err) \
        if ((y) == -1 && (x) < 0 && ((unsigned long)(x) << 1) == 0) \
                FAIL_OVF(err, "integer division"); \
        OP_INT_FLOORDIV(x,y,r,err)
    '''
    if y == -1 and x < 0 and (r_uint(x) << 1) == 0:
        raise OverflowError("integer division")
    else:
        return llop.int_floordiv(Signed, x, y)
示例#5
0
def _ll_2_int_floordiv_zer(x, y):
    if y == 0:
        raise ZeroDivisionError
    return llop.int_floordiv(lltype.Signed, x, y)
示例#6
0
def _ll_2_int_floordiv_ovf(x, y):
    if x == -sys.maxint - 1 and y == -1:
        raise OverflowError
    return llop.int_floordiv(lltype.Signed, x, y)
示例#7
0
def _ll_2_int_floordiv_ovf_zer(x, y):
    if y == 0:
        raise ZeroDivisionError
    if x == -sys.maxint - 1 and y == -1:
        raise OverflowError
    return llop.int_floordiv(lltype.Signed, x, y)
示例#8
0
def do_int_floordiv(cpu, box1, box2):
    z = llop.int_floordiv(lltype.Signed, box1.getint(), box2.getint())
    return ConstInt(z)
示例#9
0
def _ll_2_int_floordiv_zer(x, y):
    if y == 0:
        raise ZeroDivisionError
    return llop.int_floordiv(lltype.Signed, x, y)
示例#10
0
def _ll_2_int_floordiv_ovf(x, y):
    if x == -sys.maxint - 1 and y == -1:
        raise OverflowError
    return llop.int_floordiv(lltype.Signed, x, y)
示例#11
0
def _ll_2_int_floordiv_ovf_zer(x, y):
    if y == 0:
        raise ZeroDivisionError
    if x == -sys.maxint - 1 and y == -1:
        raise OverflowError
    return llop.int_floordiv(lltype.Signed, x, y)
示例#12
0
文件: executor.py 项目: alkorzt/pypy
def do_int_floordiv(cpu, box1, box2):
    z = llop.int_floordiv(lltype.Signed, box1.getint(), box2.getint())
    return ConstInt(z)