[pypy-svn] r45072 - in pypy/dist/pypy/rpython/lltypesystem: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Jul 14 14:42:49 CEST 2007
Author: arigo
Date: Sat Jul 14 14:42:48 2007
New Revision: 45072
Modified:
pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
pypy/dist/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
(lac, arigo)
Support for floats. Nothing to do, really.
Modified: pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py Sat Jul 14 14:42:48 2007
@@ -12,6 +12,7 @@
_ctypes_cache = {
lltype.Signed: ctypes.c_long,
lltype.Char: ctypes.c_ubyte,
+ lltype.Float: ctypes.c_double,
}
def build_ctypes_struct(S, max_n=None):
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 Sat Jul 14 14:42:48 2007
@@ -172,3 +172,15 @@
assert res[2] == 'd'
assert res[3] == '\x00'
rffi.free_charp(s)
+
+def test_frexp():
+ A = lltype.FixedSizeArray(lltype.Signed, 1)
+ frexp = rffi.llexternal('frexp', [lltype.Float, lltype.Ptr(A)],
+ lltype.Float, # lltype.Float == C "double" :-/
+ includes=['math.h'],
+ libraries=['m'])
+ p = lltype.malloc(A, flavor='raw')
+ res = frexp(2.5, p)
+ assert res == 0.625
+ assert p[0] == 2
+ lltype.free(p, flavor='raw')
More information about the Pypy-commit
mailing list