[pypy-svn] r72514 - in pypy/trunk/pypy: rpython/lltypesystem translator/c translator/c/test

xoraxax at codespeak.net xoraxax at codespeak.net
Mon Mar 22 00:02:53 CET 2010


Author: xoraxax
Date: Mon Mar 22 00:02:51 2010
New Revision: 72514

Modified:
   pypy/trunk/pypy/rpython/lltypesystem/rffi.py
   pypy/trunk/pypy/translator/c/primitive.py
   pypy/trunk/pypy/translator/c/test/test_database.py
Log:
Introduce a real INT type, called INT_real. Bad name, eh?

Modified: pypy/trunk/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rffi.py	Mon Mar 22 00:02:51 2010
@@ -378,6 +378,8 @@
 
 NUMBER_TYPES = setup()
 platform.numbertype_to_rclass[lltype.Signed] = int     # avoid "r_long" for common cases
+INT_real = lltype.Number("INT", INT._type)
+
 # ^^^ this creates at least the following names:
 # --------------------------------------------------------------------
 #        Type           RPython integer class doing wrap-around

Modified: pypy/trunk/pypy/translator/c/primitive.py
==============================================================================
--- pypy/trunk/pypy/translator/c/primitive.py	(original)
+++ pypy/trunk/pypy/translator/c/primitive.py	Mon Mar 22 00:02:51 2010
@@ -202,6 +202,7 @@
 define_c_primitive(rffi.SHORT, 'short')
 define_c_primitive(rffi.USHORT, 'unsigned short')
 define_c_primitive(rffi.INT, 'int')
+define_c_primitive(rffi.INT_real, 'int')
 define_c_primitive(rffi.UINT, 'unsigned int')
 define_c_primitive(rffi.LONG, 'long', 'L')
 define_c_primitive(rffi.ULONG, 'unsigned long', 'UL')

Modified: pypy/trunk/pypy/translator/c/test/test_database.py
==============================================================================
--- pypy/trunk/pypy/translator/c/test/test_database.py	(original)
+++ pypy/trunk/pypy/translator/c/test/test_database.py	Mon Mar 22 00:02:51 2010
@@ -5,7 +5,7 @@
 from pypy.objspace.flow.model import Constant, Variable, SpaceOperation
 from pypy.objspace.flow.model import Block, Link, FunctionGraph
 from pypy.rpython.typesystem import getfunctionptr
-from pypy.rpython.lltypesystem.rffi import VOIDP_real
+from pypy.rpython.lltypesystem.rffi import VOIDP_real, INT_real, INT
 
 
 def dump_on_stdout(database):
@@ -227,6 +227,14 @@
     db = LowLevelDatabase()
     assert db.gettype(A) == "void *@"
 
+def test_intlong_unique():
+    A = INT_real
+    B = Signed
+    db = LowLevelDatabase()
+    assert db.gettype(A) == "int @"
+    assert db.gettype(B) == "long @"
+
+
 def test_recursive_struct():
     S = GcForwardReference()
     S.become(GcStruct('testing', ('p', Ptr(S))))



More information about the Pypy-commit mailing list