Example #1
0
def ullong_floordiv_zer(x, y):
    '''#define OP_ULLONG_FLOORDIV_ZER(x,y,r) \
      if ((y)) { OP_ULLONG_FLOORDIV(x,y,r); } \
      else FAIL_ZER("unsigned integer division")
    '''
    if y:
        return llop.llong_floordiv(UnsignedLongLong, x, y)
    else:
        raise ZeroDivisionError("unsigned integer division")
Example #2
0
def ullong_floordiv_zer(x, y):
    '''#define OP_ULLONG_FLOORDIV_ZER(x,y,r) \
      if ((y)) { OP_ULLONG_FLOORDIV(x,y,r); } \
      else FAIL_ZER("unsigned integer division")
    '''
    if y:
        return llop.llong_floordiv(UnsignedLongLong, x, y)
    else:
        raise ZeroDivisionError("unsigned integer division")
Example #3
0
 def ll_llong_py_div(x, y):
     r = llop.llong_floordiv(SignedLongLong, x, y)  # <= truncates like in C
     p = r * y
     if y < 0: u = p - x
     else:     u = x - p
     return r + (u >> LLONG_BITS_1)
Example #4
0
def _ll_2_llong_floordiv_zer(xll, yll):
    if yll == 0:
        raise ZeroDivisionError
    return llop.llong_floordiv(lltype.SignedLongLong, xll, yll)
Example #5
0
def _ll_2_llong_floordiv(xll, yll):
    return llop.llong_floordiv(lltype.SignedLongLong, xll, yll)
Example #6
0
def _ll_2_llong_floordiv_zer(xll, yll):
    if yll == 0:
        raise ZeroDivisionError
    return llop.llong_floordiv(lltype.SignedLongLong, xll, yll)
Example #7
0
def _ll_2_llong_floordiv(xll, yll):
    return llop.llong_floordiv(lltype.SignedLongLong, xll, yll)
Example #8
0
 def ll_llong_py_div(x, y):
     r = llop.llong_floordiv(SignedLongLong, x, y)  # <= truncates like in C
     p = r * y
     if y < 0: u = p - x
     else: u = x - p
     return r + (u >> LLONG_BITS_1)