Author: Antonio Cuni <anto.c...@gmail.com>
Branch: ffistruct
Changeset: r51273:1e4a336da3a3
Date: 2012-01-12 12:30 +0100
http://bitbucket.org/pypy/pypy/changeset/1e4a336da3a3/

Log:    migrate the float and singlefloat cases to GetFieldConverter

diff --git a/pypy/module/_ffi/interp_struct.py 
b/pypy/module/_ffi/interp_struct.py
--- a/pypy/module/_ffi/interp_struct.py
+++ b/pypy/module/_ffi/interp_struct.py
@@ -149,12 +149,10 @@
             return converter.do_and_wrap(w_ffitype)
         #
         if w_ffitype.is_double():
-            value = libffi.struct_getfield_float(w_ffitype.ffitype, 
self.rawmem, offset)
-            return space.wrap(value)
+            return converter.do_and_wrap(w_ffitype)
         #
         if w_ffitype.is_singlefloat():
-            value = libffi.struct_getfield_singlefloat(w_ffitype.ffitype, 
self.rawmem, offset)
-            return space.wrap(float(value))
+            return converter.do_and_wrap(w_ffitype)
         #
         raise operationerrfmt(space.w_TypeError, 'Unknown type: %s', 
w_ffitype.name)
 
@@ -226,11 +224,13 @@
     def get_unichar(self, w_ffitype):
         return libffi.struct_getfield_int(w_ffitype.ffitype, self.rawmem, 
self.offset)
 
-    ## def get_float(self, w_ffitype):
-    ##     ...
+    def get_float(self, w_ffitype):
+        return libffi.struct_getfield_float(w_ffitype.ffitype, self.rawmem, 
self.offset)
 
-    ## def get_singlefloat(self, w_ffitype):
-    ##     ...
+    def get_singlefloat(self, w_ffitype):
+        return libffi.struct_getfield_singlefloat(w_ffitype.ffitype, 
self.rawmem,
+                                                  self.offset)
+
 
     ## def get_struct(self, w_datashape):
     ##     ...
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to