[pypy-svn] r48006 - pypy/dist/pypy/rpython/raisingops

rxe at codespeak.net rxe at codespeak.net
Fri Oct 26 00:12:18 CEST 2007


Author: rxe
Date: Fri Oct 26 00:12:18 2007
New Revision: 48006

Modified:
   pypy/dist/pypy/rpython/raisingops/raisingops.py
Log:
int_add_nonneg_ovf operation seems to be needed these days

Modified: pypy/dist/pypy/rpython/raisingops/raisingops.py
==============================================================================
--- pypy/dist/pypy/rpython/raisingops/raisingops.py	(original)
+++ pypy/dist/pypy/rpython/raisingops/raisingops.py	Fri Oct 26 00:12:18 2007
@@ -71,6 +71,18 @@
     else:
         raise OverflowError("integer addition")
 
+def int_add_nonneg_ovf(x, y):
+    '''
+    OP_INT_ADD(x,y,r); \
+    if (r >= (x)); \
+    else FAIL_OVF("integer addition")
+    '''
+    r = x + y
+    if r >= x:
+        return r
+    else:
+        raise OverflowError("integer addition")
+
 def int_sub_ovf(x, y):
     '''#define OP_INT_SUB_OVF(x,y,r,err) \
         OP_INT_SUB(x,y,r,err); \



More information about the Pypy-commit mailing list