Author: stian
Branch: math-improvements
Changeset: r92810:e4fc38341ad9
Date: 2017-10-21 05:56 +0200
http://bitbucket.org/pypy/pypy/changeset/e4fc38341ad9/

Log:    Add uint128_t, and use it to speed up mul and lshift slightly. TODO:
        Tests missing.

diff --git a/pypy/objspace/std/longobject.py b/pypy/objspace/std/longobject.py
--- a/pypy/objspace/std/longobject.py
+++ b/pypy/objspace/std/longobject.py
@@ -460,11 +460,9 @@
                     return space.w_NotImplemented
                 return func(self, space, w_other)
         else:
-            @delegate_other
             @func_renamer('descr_' + opname)
             def descr_binop(self, space, w_other):
                 return func(self, space, w_other)
-        @delegate_other
         @func_renamer('descr_r' + opname)
         def descr_rbinop(self, space, w_other):
             if not isinstance(w_other, W_LongObject):
diff --git a/rpython/rlib/rarithmetic.py b/rpython/rlib/rarithmetic.py
--- a/rpython/rlib/rarithmetic.py
+++ b/rpython/rlib/rarithmetic.py
@@ -614,6 +614,7 @@
 r_ulonglong = build_int('r_ulonglong', False, 64)
 
 r_longlonglong = build_int('r_longlonglong', True, 128)
+r_ulonglonglong = build_int('r_ulonglonglong', False, 128)
 longlongmax = r_longlong(LONGLONG_TEST - 1)
 
 if r_longlong is not r_int:
diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -27,6 +27,7 @@
     else:
         UDIGIT_MASK = longlongmask
     LONG_TYPE = rffi.__INT128_T
+    ULONG_TYPE = rffi.__UINT128_T
     if LONG_BIT > SHIFT:
         STORE_TYPE = lltype.Signed
         UNSIGNED_TYPE = lltype.Unsigned
@@ -40,7 +41,8 @@
     STORE_TYPE = lltype.Signed
     UNSIGNED_TYPE = lltype.Unsigned
     LONG_TYPE = rffi.LONGLONG
-
+    ULONG_TYPE = rffi.ULONGLONG
+    
 MASK = int((1 << SHIFT) - 1)
 FLOAT_MULTIPLIER = float(1 << SHIFT)
 
@@ -97,6 +99,9 @@
 def _widen_digit(x):
     return rffi.cast(LONG_TYPE, x)
 
+def _unsigned_widen_digit(x):
+    return rffi.cast(ULONG_TYPE, x)
+    
 @specialize.argtype(0)
 def _store_digit(x):
     return rffi.cast(STORE_TYPE, x)
@@ -139,15 +144,16 @@
     """This is a reimplementation of longs using a list of digits."""
     _immutable_ = True
     _immutable_fields_ = ["_digits"]
-
+    
     def __init__(self, digits=NULLDIGITS, sign=0, size=0):
         if not we_are_translated():
             _check_digits(digits)
         make_sure_not_resized(digits)
         self._digits = digits
+        
         assert size >= 0
+        self.size = size or len(digits)
         
-        self.size = size or len(digits)
         self.sign = sign
 
     # __eq__ and __ne__ method exist for testingl only, they are not RPython!
@@ -172,6 +178,12 @@
         return _widen_digit(self._digits[x])
     widedigit._always_inline_ = True
 
+    def uwidedigit(self, x):
+        """Return the x'th digit, as a long long int if needed
+        to have enough room to contain two digits."""
+        return _unsigned_widen_digit(self._digits[x])
+    uwidedigit._always_inline_ = True
+    
     def udigit(self, x):
         """Return the x'th digit, as an unsigned int."""
         return _load_unsigned_digit(self._digits[x])
@@ -701,9 +713,9 @@
             if a._digits[0] == NULLDIGIT:
                 return NULLRBIGINT
             elif a._digits[0] == ONEDIGIT:
-                return rbigint(b._digits[:b.numdigits()], a.sign * b.sign, 
b.numdigits())
+                return rbigint(b._digits[:bsize], a.sign * b.sign, bsize)
             elif bsize == 1:
-                res = b.widedigit(0) * a.widedigit(0)
+                res = b.uwidedigit(0) * a.uwidedigit(0)
                 carry = res >> SHIFT
                 if carry:
                     return rbigint([_store_digit(res & MASK), 
_store_digit(carry)], a.sign * b.sign, 2)
@@ -740,6 +752,7 @@
 
         asize = self.numdigits()
         digit = abs(b)
+        
         bsign = -1 if b < 0 else 1
 
         if digit == 1:
@@ -747,7 +760,8 @@
                 return self
             return rbigint(self._digits[:asize], self.sign * bsign, asize)
         elif asize == 1:
-            res = self.widedigit(0) * digit
+            udigit = r_uint(digit)
+            res = self.uwidedigit(0) * udigit
             carry = res >> SHIFT
             if carry:
                 return rbigint([_store_digit(res & MASK), 
_store_digit(carry)], self.sign * bsign, 2)
@@ -839,7 +853,7 @@
                     rem = self.widedigit(size)
                     size -= 1
                     while size >= 0:
-                        rem = ((rem << SHIFT) + self.widedigit(size)) % digit
+                        rem = ((rem << SHIFT) | self.digit(size)) % digit
                         size -= 1
                 else:
                     rem = self.digit(0) % digit
@@ -880,7 +894,7 @@
                     rem = self.widedigit(size)
                     size -= 1
                     while size >= 0:
-                        rem = ((rem << SHIFT) + self.widedigit(size)) % digit
+                        rem = ((rem << SHIFT) | self.digit(size)) % digit
                         size -= 1
                 else:
                     rem = self.digit(0) % digit
@@ -1210,10 +1224,10 @@
         oldsize = self.numdigits()
         newsize = oldsize + wordshift + 1
         z = rbigint([NULLDIGIT] * newsize, self.sign, newsize)
-        accum = _widen_digit(0)
+        accum = _unsigned_widen_digit(0)
         j = 0
         while j < oldsize:
-            accum += self.widedigit(j) << remshift
+            accum += self.uwidedigit(j) << remshift
             z.setdigit(wordshift, accum)
             accum >>= SHIFT
             wordshift += 1
@@ -1235,10 +1249,10 @@
         oldsize = self.numdigits()
 
         z = rbigint([NULLDIGIT] * (oldsize + 1), self.sign, (oldsize + 1))
-        accum = _widen_digit(0)
+        accum = _unsigned_widen_digit(0)
         i = 0
         while i < oldsize:
-            accum += self.widedigit(i) << int_other
+            accum += self.uwidedigit(i) << int_other
             z.setdigit(i, accum)
             accum >>= SHIFT
             i += 1
@@ -1267,9 +1281,9 @@
         z = rbigint([NULLDIGIT] * newsize, self.sign, newsize)
         i = 0
         while i < newsize:
-            newdigit = (self.digit(wordshift) >> loshift)
+            newdigit = (self.udigit(wordshift) >> loshift)
             if i+1 < newsize:
-                newdigit |= (self.digit(wordshift+1) << hishift)
+                newdigit |= (self.udigit(wordshift+1) << hishift)
             z.setdigit(i, newdigit)
             i += 1
             wordshift += 1
@@ -1661,11 +1675,11 @@
         z = rbigint([NULLDIGIT] * (size_a + size_b), 1)
         i = UDIGIT_TYPE(0)
         while i < size_a:
-            f = a.widedigit(i)
+            f = a.uwidedigit(i)
             pz = i << 1
             pa = i + 1
 
-            carry = z.widedigit(pz) + f * f
+            carry = z.uwidedigit(pz) + f * f
             z.setdigit(pz, carry)
             pz += 1
             carry >>= SHIFT
@@ -1675,18 +1689,18 @@
             # pyramid it appears.  Same as adding f<<1 once.
             f <<= 1
             while pa < size_a:
-                carry += z.widedigit(pz) + a.widedigit(pa) * f
+                carry += z.uwidedigit(pz) + a.uwidedigit(pa) * f
                 pa += 1
                 z.setdigit(pz, carry)
                 pz += 1
                 carry >>= SHIFT
             if carry:
-                carry += z.widedigit(pz)
+                carry += z.uwidedigit(pz)
                 z.setdigit(pz, carry)
                 pz += 1
                 carry >>= SHIFT
             if carry:
-                z.setdigit(pz, z.widedigit(pz) + carry)
+                z.setdigit(pz, z.uwidedigit(pz) + carry)
             assert (carry >> SHIFT) == 0
             i += 1
         z._normalize()
@@ -1707,10 +1721,10 @@
     size_a1 = UDIGIT_TYPE(size_a - 1)
     size_b1 = UDIGIT_TYPE(size_b - 1)
     while i < size_a1:
-        f0 = a.widedigit(i)
-        f1 = a.widedigit(i + 1)
+        f0 = a.uwidedigit(i)
+        f1 = a.uwidedigit(i + 1)
         pz = i
-        carry = z.widedigit(pz) + b.widedigit(0) * f0
+        carry = z.uwidedigit(pz) + b.uwidedigit(0) * f0
         z.setdigit(pz, carry)
         pz += 1
         carry >>= SHIFT
@@ -1722,14 +1736,14 @@
             # b.widedigit(j + 1) * f0 < (2**(B-1) - 1)**2; so
             # carry + z.widedigit(pz) + b.widedigit(j + 1) * f0 +
             # b.widedigit(j) * f1 < 2**(2*B - 1) - 2**B < 2**LONG)BIT - 1
-            carry += z.widedigit(pz) + b.widedigit(j + 1) * f0 + \
-                     b.widedigit(j) * f1
+            carry += z.uwidedigit(pz) + b.uwidedigit(j + 1) * f0 + \
+                     b.uwidedigit(j) * f1
             z.setdigit(pz, carry)
             pz += 1
             carry >>= SHIFT
             j += 1
         # carry < 2**(B + 1) - 2
-        carry += z.widedigit(pz) + b.widedigit(size_b1) * f1
+        carry += z.uwidedigit(pz) + b.uwidedigit(size_b1) * f1
         z.setdigit(pz, carry)
         pz += 1
         carry >>= SHIFT
@@ -1740,17 +1754,17 @@
         i += 2
     if size_a & 1:
         pz = size_a1
-        f = a.widedigit(pz)
+        f = a.uwidedigit(pz)
         pb = 0
-        carry = _widen_digit(0)
+        carry = _unsigned_widen_digit(0)
         while pb < size_b:
-            carry += z.widedigit(pz) + b.widedigit(pb) * f
+            carry += z.uwidedigit(pz) + b.uwidedigit(pb) * f
             pb += 1
             z.setdigit(pz, carry)
             pz += 1
             carry >>= SHIFT
         if carry:
-            z.setdigit(pz, z.widedigit(pz) + carry)
+            z.setdigit(pz, z.uwidedigit(pz) + carry)
     z._normalize()
     return z
 
@@ -1767,7 +1781,7 @@
 
     # We use "or" her to avoid having a check where list can be empty in 
_normalize.
     lo = rbigint(n._digits[:size_lo] or NULLDIGITS, 1)
-    hi = rbigint(n._digits[size_lo:n.size] or NULLDIGITS, 1)
+    hi = rbigint(n._digits[size_lo:size_n] or NULLDIGITS, 1)
     lo._normalize()
     hi._normalize()
     return hi, lo
@@ -1980,7 +1994,7 @@
         size = pin.numdigits()
     size -= 1
     while size >= 0:
-        rem = (rem << SHIFT) | pin.widedigit(size)
+        rem = (rem << SHIFT) | pin.digit(size)
         hi = rem // n
         pout.setdigit(size, hi)
         rem -= hi * n
@@ -2057,14 +2071,15 @@
 def _muladd1(a, n, extra=0):
     """Multiply by a single digit and add a single digit, ignoring the sign.
     """
-
+    assert n > 0
+    
     size_a = a.numdigits()
     z = rbigint([NULLDIGIT] * (size_a+1), 1)
     assert extra & MASK == extra
-    carry = _widen_digit(extra)
+    carry = _unsigned_widen_digit(extra)
     i = 0
     while i < size_a:
-        carry += a.widedigit(i) * n
+        carry += a.uwidedigit(i) * n
         z.setdigit(i, carry)
         carry >>= SHIFT
         i += 1
@@ -2081,7 +2096,7 @@
     assert 0 <= d and d < SHIFT
     i = 0
     while i < m:
-        acc = a.widedigit(i) << d | carry
+        acc = a.uwidedigit(i) << d | carry
         z.setdigit(i, acc)
         carry = acc >> SHIFT
         i += 1
@@ -2093,14 +2108,14 @@
         * result in z[0:m], and return the d bits shifted out of the bottom.
     """
 
-    carry = _widen_digit(0)
-    acc = _widen_digit(0)
+    carry = _unsigned_widen_digit(0)
+    acc = _unsigned_widen_digit(0)
     mask = (1 << d) - 1
 
     assert 0 <= d and d < SHIFT
     i = m-1
     while i >= 0:
-        acc = (carry << SHIFT) | a.widedigit(i)
+        acc = (carry << SHIFT) | a.uwidedigit(i)
         carry = acc & mask
         z.setdigit(i, acc >> d)
         i -= 1
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -175,7 +175,16 @@
                 if res >= (1 << 127):
                     res -= 1 << 128
                 return res
+        class c_uint128(ctypes.Array):   # based on 2 ulongs
+            _type_ = ctypes.c_uint64
+            _length_ = 2
+            @property
+            def value(self):
+                res = self[0] | (self[1] << 64)
+                return res   
+                
         _ctypes_cache[rffi.__INT128_T] = c_int128
+        _ctypes_cache[rffi.__UINT128_T] = c_uint128
 
     # for unicode strings, do not use ctypes.c_wchar because ctypes
     # automatically converts arrays into unicode strings.
diff --git a/rpython/rtyper/lltypesystem/lloperation.py 
b/rpython/rtyper/lltypesystem/lloperation.py
--- a/rpython/rtyper/lltypesystem/lloperation.py
+++ b/rpython/rtyper/lltypesystem/lloperation.py
@@ -320,6 +320,28 @@
     'lllong_rshift':         LLOp(canfold=True),  # args (r_longlonglong, int)
     'lllong_xor':            LLOp(canfold=True),
 
+    'ulllong_is_true':        LLOp(canfold=True),
+    'ulllong_neg':            LLOp(canfold=True),
+    'ulllong_abs':            LLOp(canfold=True),
+    'ulllong_invert':         LLOp(canfold=True),
+
+    'ulllong_add':            LLOp(canfold=True),
+    'ulllong_sub':            LLOp(canfold=True),
+    'ulllong_mul':            LLOp(canfold=True),
+    'ulllong_floordiv':       LLOp(canfold=True),
+    'ulllong_mod':            LLOp(canfold=True),
+    'ulllong_lt':             LLOp(canfold=True),
+    'ulllong_le':             LLOp(canfold=True),
+    'ulllong_eq':             LLOp(canfold=True),
+    'ulllong_ne':             LLOp(canfold=True),
+    'ulllong_gt':             LLOp(canfold=True),
+    'ulllong_ge':             LLOp(canfold=True),
+    'ulllong_and':            LLOp(canfold=True),
+    'ulllong_or':             LLOp(canfold=True),
+    'ulllong_lshift':         LLOp(canfold=True),  # args (r_ulonglonglong, 
int)
+    'ulllong_rshift':         LLOp(canfold=True),  # args (r_ulonglonglong, 
int)
+    'ulllong_xor':            LLOp(canfold=True),
+    
     'cast_primitive':       LLOp(canfold=True),
     'cast_bool_to_int':     LLOp(canfold=True),
     'cast_bool_to_uint':    LLOp(canfold=True),
diff --git a/rpython/rtyper/lltypesystem/lltype.py 
b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -8,7 +8,7 @@
 from rpython.rlib.rarithmetic import (
     base_int, intmask, is_emulated_long, is_valid_int, longlonglongmask,
     longlongmask, maxint, normalizedinttype, r_int, r_longfloat, r_longlong,
-    r_longlonglong, r_singlefloat, r_uint, r_ulonglong)
+    r_longlonglong, r_singlefloat, r_uint, r_ulonglong, r_ulonglonglong)
 from rpython.rtyper.extregistry import ExtRegistryEntry
 from rpython.tool import leakfinder
 from rpython.tool.identity_dict import identity_dict
@@ -676,6 +676,7 @@
 _numbertypes[r_int] = _numbertypes[int]
 _numbertypes[r_longlonglong] = Number("SignedLongLongLong", r_longlonglong,
                                       longlonglongmask)
+
 if r_longlong is not r_int:
     _numbertypes[r_longlong] = Number("SignedLongLong", r_longlong,
                                       longlongmask)
@@ -700,6 +701,7 @@
 SignedLongLong = build_number("SignedLongLong", r_longlong)
 SignedLongLongLong = build_number("SignedLongLongLong", r_longlonglong)
 UnsignedLongLong = build_number("UnsignedLongLong", r_ulonglong)
+UnsignedLongLongLong = build_number("UnsignedLongLongLong", r_ulonglonglong)
 
 Float       = Primitive("Float",       0.0)                  # C type 'double'
 SingleFloat = Primitive("SingleFloat", r_singlefloat(0.0))   # 'float'
diff --git a/rpython/rtyper/lltypesystem/opimpl.py 
b/rpython/rtyper/lltypesystem/opimpl.py
--- a/rpython/rtyper/lltypesystem/opimpl.py
+++ b/rpython/rtyper/lltypesystem/opimpl.py
@@ -17,7 +17,7 @@
 
 # global synonyms for some types
 from rpython.rlib.rarithmetic import intmask
-from rpython.rlib.rarithmetic import r_int, r_uint, r_longlong, r_ulonglong, 
r_longlonglong
+from rpython.rlib.rarithmetic import r_int, r_uint, r_longlong, r_ulonglong, 
r_longlonglong, r_ulonglonglong
 from rpython.rtyper.lltypesystem.llmemory import AddressAsInt
 
 if r_longlong is r_int:
@@ -38,6 +38,7 @@
     'llong': r_longlong_arg,
     'ullong': r_ulonglong,
     'lllong': r_longlonglong,
+    'ulllong': r_ulonglonglong,
     }
 
 def no_op(x):
@@ -366,6 +367,16 @@
     assert is_valid_int(y)
     return r_ulonglong(x >> y)
 
+def op_ulllong_lshift(x, y):
+    assert isinstance(x, r_ulonglonglong)
+    assert isinstance(y, int)
+    return r_ulonglonglong(x << y)
+
+def op_ulllong_rshift(x, y):
+    assert isinstance(x, r_ulonglonglong)
+    assert is_valid_int(y)
+    return r_ulonglonglong(x >> y)
+    
 def op_same_as(x):
     return x
 
diff --git a/rpython/rtyper/lltypesystem/rffi.py 
b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -506,7 +506,7 @@
 # This is a bit of a hack since we can't use rffi_platform here.
 try:
     sizeof_c_type('__int128_t', ignore_errors=True)
-    TYPES += ['__int128_t']
+    TYPES += ['__int128_t', '__uint128_t']
 except CompilationError:
     pass
 
@@ -538,6 +538,8 @@
         if name.startswith('unsigned'):
             name = 'u' + name[9:]
             signed = False
+        elif name.startswith('__u'):
+            signed = False
         elif name == 'size_t' or name.startswith('uint'):
             signed = False
         else:
diff --git a/rpython/rtyper/rint.py b/rpython/rtyper/rint.py
--- a/rpython/rtyper/rint.py
+++ b/rpython/rtyper/rint.py
@@ -4,11 +4,11 @@
 from rpython.flowspace.operation import op_appendices
 from rpython.rlib import objectmodel, jit
 from rpython.rlib.rarithmetic import intmask, longlongmask, r_int, r_longlong
-from rpython.rlib.rarithmetic import r_uint, r_ulonglong, r_longlonglong
+from rpython.rlib.rarithmetic import r_uint, r_ulonglong, r_longlonglong, 
r_ulonglonglong
 from rpython.rtyper.error import TyperError
 from rpython.rtyper.lltypesystem.lltype import (Signed, Unsigned, Bool, Float,
     Char, UniChar, UnsignedLongLong, SignedLongLong, build_number, Number,
-    cast_primitive, typeOf, SignedLongLongLong)
+    cast_primitive, typeOf, SignedLongLongLong, UnsignedLongLongLong)
 from rpython.rtyper.rfloat import FloatRepr
 from rpython.rtyper.rmodel import inputconst, log
 from rpython.tool.pairtype import pairtype
@@ -188,6 +188,7 @@
 signedlonglonglong_repr = getintegerrepr(SignedLongLongLong, 'lllong_')
 unsigned_repr = getintegerrepr(Unsigned, 'uint_')
 unsignedlonglong_repr = getintegerrepr(UnsignedLongLong, 'ullong_')
+signedlonglonglong_repr = getintegerrepr(UnsignedLongLongLong, 'ulllong_')
 
 class __extend__(pairtype(IntegerRepr, IntegerRepr)):
 
@@ -473,7 +474,15 @@
         raise ZeroDivisionError("longlonglong division")
     return ll_lllong_py_div(x, y)
 
[email protected]_look_inside
+def ll_ulllong_py_div(x, y):
+    return llop.ullong_floordiv(UnsignedLongLongLong, x, y)
 
+def ll_ulllong_py_div_zer(x, y):
+    if y == 0:
+        raise ZeroDivisionError("unsigned longlonglong division")
+    return ll_ulllong_py_div(x, y)
+    
 # ---------- mod ----------
 
 @jit.oopspec("int.py_mod(x, y)")
@@ -553,6 +562,15 @@
     if y == 0:
         raise ZeroDivisionError
     return ll_lllong_py_mod(x, y)
+    
[email protected]_look_inside
+def ll_ulllong_py_mod(x, y):
+    return llop.ullong_mod(UnsignedLongLongLong, x, y)
+
+def ll_ulllong_py_mod_zer(x, y):
+    if y == 0:
+        raise ZeroDivisionError
+    return ll_ulllong_py_mod(x, y)
 
 
 # ---------- lshift, neg, abs ----------
diff --git a/rpython/translator/c/primitive.py 
b/rpython/translator/c/primitive.py
--- a/rpython/translator/c/primitive.py
+++ b/rpython/translator/c/primitive.py
@@ -263,3 +263,4 @@
 define_c_primitive(rffi.ULONGLONG, 'unsigned long long', 'ULL')
 if SUPPORT_INT128:
     define_c_primitive(rffi.__INT128_T, '__int128_t', 'LL') # Unless it's a 
128bit platform, LL is the biggest
+    define_c_primitive(rffi.__UINT128_T, '__uint128_t', 'ULL')
diff --git a/rpython/translator/c/src/int.h b/rpython/translator/c/src/int.h
--- a/rpython/translator/c/src/int.h
+++ b/rpython/translator/c/src/int.h
@@ -113,6 +113,7 @@
 #define OP_ULLONG_RSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, PYPY_LONGLONG_BIT); \
                                                r = (x) >> (y)
 #define OP_LLLONG_RSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, 128); r = (x) >> (y)
+#define OP_ULLLONG_RSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, 128); r = (x) >> (y)
 
 /* left-shift of a signed value: C99 makes the result undefined if the
    value is negative.  Force the left-shift to occur on unsigned instead. */
@@ -127,6 +128,8 @@
                                                        r = (x) << (y)
 #define OP_ULLONG_LSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, PYPY_LONGLONG_BIT); \
                                                        r = (x) << (y)
+#define OP_ULLLONG_LSHIFT(x,y,r) CHECK_SHIFT_RANGE(y, 128); \
+                                                        r = (x) << (y)
 
 /* floor division */
 
@@ -135,6 +138,7 @@
 #define OP_LLONG_FLOORDIV(x,y,r)  r = (x) / (y)
 #define OP_ULLONG_FLOORDIV(x,y,r) r = (x) / (y)
 #define OP_LLLONG_FLOORDIV(x,y,r)  r = (x) / (y)
+#define OP_ULLLONG_FLOORDIV(x,y,r)  r = (x) / (y)
 
 /* modulus */
 
@@ -143,6 +147,7 @@
 #define OP_LLONG_MOD(x,y,r)   r = (x) % (y)
 #define OP_ULLONG_MOD(x,y,r)  r = (x) % (y)
 #define OP_LLLONG_MOD(x,y,r)   r = (x) % (y)
+#define OP_ULLLONG_MOD(x,y,r)   r = (x) % (y)
 
 /* bit operations */
 
@@ -253,3 +258,19 @@
 #define OP_ULLONG_AND OP_LLONG_AND
 #define OP_ULLONG_OR OP_LLONG_OR
 #define OP_ULLONG_XOR OP_LLONG_XOR
+
+#define OP_ULLLONG_IS_TRUE OP_LLONG_IS_TRUE
+#define OP_ULLLONG_INVERT  OP_LLONG_INVERT
+#define OP_ULLLONG_ADD OP_LLONG_ADD
+#define OP_ULLLONG_SUB OP_LLONG_SUB
+#define OP_ULLLONG_MUL OP_LLONG_MUL
+#define OP_ULLLONG_LT OP_LLONG_LT
+#define OP_ULLLONG_LE OP_LLONG_LE
+#define OP_ULLLONG_EQ OP_LLONG_EQ
+#define OP_ULLLONG_NE OP_LLONG_NE
+#define OP_ULLLONG_GT OP_LLONG_GT
+#define OP_ULLLONG_GE OP_LLONG_GE
+#define OP_ULLLONG_AND OP_LLONG_AND
+#define OP_ULLLONG_OR OP_LLONG_OR
+#define OP_ULLLONG_XOR OP_LLONG_XOR
+
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to