[pypy-commit] pypy ffistruct: use truncatedlonglong_w instead of manually converting to bigint and then call ulonglongmask

antocuni noreply at buildbot.pypy.org
Thu Jan 12 14:30:08 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: ffistruct
Changeset: r51276:903365dd2b8f
Date: 2012-01-12 14:29 +0100
http://bitbucket.org/pypy/pypy/changeset/903365dd2b8f/

Log:	use truncatedlonglong_w instead of manually converting to bigint and
	then call ulonglongmask

diff --git a/pypy/module/_ffi/type_converter.py b/pypy/module/_ffi/type_converter.py
--- a/pypy/module/_ffi/type_converter.py
+++ b/pypy/module/_ffi/type_converter.py
@@ -58,10 +58,8 @@
     def _longlong(self, w_ffitype, w_obj):
         # a separate function, which can be seen by the jit or not,
         # depending on whether longlongs are supported
-        bigval = self.space.bigint_w(w_obj) # XXX, use truncatedlonglong?
-        ullval = bigval.ulonglongmask()
-        llval = rffi.cast(rffi.LONGLONG, ullval)
-        self.handle_longlong(w_ffitype, w_obj, llval)
+        longlongval = self.space.truncatedlonglong_w(w_obj)
+        self.handle_longlong(w_ffitype, w_obj, longlongval)
 
     def _float(self, w_ffitype, w_obj):
         # a separate function, which can be seen by the jit or not,


More information about the pypy-commit mailing list