[pypy-svn] r75295 - pypy/branch/int-between/pypy/rpython

arigo at codespeak.net arigo at codespeak.net
Fri Jun 11 23:04:22 CEST 2010


Author: arigo
Date: Fri Jun 11 23:04:21 2010
New Revision: 75295

Modified:
   pypy/branch/int-between/pypy/rpython/normalizecalls.py
Log:
Add support for subtraction between TotalOrderSymbolic.


Modified: pypy/branch/int-between/pypy/rpython/normalizecalls.py
==============================================================================
--- pypy/branch/int-between/pypy/rpython/normalizecalls.py	(original)
+++ pypy/branch/int-between/pypy/rpython/normalizecalls.py	Fri Jun 11 23:04:21 2010
@@ -292,6 +292,13 @@
         else:
             return cmp(self.orderwitness, other.orderwitness)
 
+    # support for implementing int_between: (a<=b<=c) with (b-a<=c-a)
+    # see pypy.jit.metainterp.pyjitpl.opimpl_int_between
+    def __sub__(self, other):
+        return self.compute_fn() - other
+    def __rsub__(self, other):
+        return other - self.compute_fn()
+
     def compute_fn(self):
         if self.value is None:
             self.peers.sort()



More information about the Pypy-commit mailing list