[pypy-svn] r12800 - pypy/dist/pypy/rpython
ericvrp at codespeak.net
ericvrp at codespeak.net
Thu May 26 09:52:10 CEST 2005
Author: ericvrp
Date: Thu May 26 09:52:09 2005
New Revision: 12800
Modified:
pypy/dist/pypy/rpython/rint.py
Log:
added rtype_sub and SomeInteger.rtype_is_true , will try to do a more complete list next
Modified: pypy/dist/pypy/rpython/rint.py
==============================================================================
--- pypy/dist/pypy/rpython/rint.py (original)
+++ pypy/dist/pypy/rpython/rint.py Thu May 26 09:52:09 2005
@@ -24,6 +24,18 @@
rtype_inplace_add = rtype_add
+ def rtype_sub((s_int1, s_int2)):
+ if s_int1.unsigned or s_int2.unsigned:
+ v_int1 = receive(Unsigned, arg=0)
+ v_int2 = receive(Unsigned, arg=1)
+ return direct_op('uint_sub', [v_int1, v_int2], resulttype=Unsigned)
+ else:
+ v_int1 = receive(Signed, arg=0)
+ v_int2 = receive(Signed, arg=1)
+ return direct_op('int_sub', [v_int1, v_int2], resulttype=Signed)
+
+ rtype_inplace_sub = rtype_sub
+
def rtype_lt((s_int1, s_int2)):
if s_int1.unsigned or s_int2.unsigned:
if not s_int1.nonneg or not s_int2.nonneg:
@@ -37,6 +49,12 @@
return direct_op('int_lt', [v_int1, v_int2], resulttype=Bool)
+class __extend__(SomeInteger):
+
+ def rtype_is_true(s_int):
+ v_int = receive(Signed, arg=0)
+ return direct_op('int_is_true', [v_int], resulttype=Bool)
+
class __extend__(SomeBool):
More information about the Pypy-commit
mailing list