[pypy-svn] r47112 - in pypy/dist/pypy/rpython/lltypesystem: . test

mwh at codespeak.net mwh at codespeak.net
Wed Oct 3 14:45:34 CEST 2007


Author: mwh
Date: Wed Oct  3 14:45:32 2007
New Revision: 47112

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rffi.py
   pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
the beginnings of fixes for 64-bit support


Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py	Wed Oct  3 14:45:32 2007
@@ -188,6 +188,10 @@
 #        ULONGLONG      r_ulonglong
 #        SIZE_T         r_size_t
 # --------------------------------------------------------------------
+# Note that rffi.r_int is not necessarily the same as
+# rarithmetic.r_int, etc!  rffi.INT/r_int correspond to the C-level
+# 'int' type, whereas rarithmetic.r_int corresponds to the
+# Python-level int type (which is a C long).  Fun.
 
 def CStruct(name, *fields, **kwds):
     """ A small helper to create external C structure, not the

Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py	Wed Oct  3 14:45:32 2007
@@ -29,9 +29,9 @@
         res = ctypes2lltype(lltype.SingleFloat, ctypes.c_float(-3.5))
         assert isinstance(res, rffi.r_singlefloat)
         assert float(res) == -3.5
-        assert lltype2ctypes(rffi.r_uint(-1)) == sys.maxint * 2 + 1
+        assert lltype2ctypes(rffi.r_ulong(-1)) == sys.maxint * 2 + 1
         res = ctypes2lltype(lltype.Unsigned, sys.maxint * 2 + 1)
-        assert (res, type(res)) == (rffi.r_uint(-1), rffi.r_uint)
+        assert (res, type(res)) == (rffi.r_ulong(-1), rffi.r_ulong)
 
         res = lltype2ctypes(llmemory.sizeof(lltype.Signed))
         assert res == struct.calcsize("l")
@@ -377,7 +377,7 @@
             p1 = rffi.cast(SIGNEDPTR, p1)
             p2 = rffi.cast(SIGNEDPTR, p2)
             print 'my_compar:', p1[0], p2[0]
-            return cmp(p1[0], p2[0])
+            return rffi.cast(rffi.INT, cmp(p1[0], p2[0]))
 
         qsort(rffi.cast(rffi.VOIDP, a),
               rffi.cast(rffi.SIZE_T, 10),


More information about the pypy-svn mailing list