[pypy-commit] pypy stdlib-2.7.6: fix rawffi, again

bdkearns noreply at buildbot.pypy.org
Tue Mar 4 09:46:09 CET 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.6
Changeset: r69665:4b0a917d09f4
Date: 2014-03-04 03:45 -0500
http://bitbucket.org/pypy/pypy/changeset/4b0a917d09f4/

Log:	fix rawffi, again

diff --git a/pypy/module/_rawffi/structure.py b/pypy/module/_rawffi/structure.py
--- a/pypy/module/_rawffi/structure.py
+++ b/pypy/module/_rawffi/structure.py
@@ -289,8 +289,9 @@
             if numbits:
                 lowbit = LOW_BIT(bitsize)
                 bitmask = BIT_MASK(numbits, TP)
-                value = widen(value)
-                current = widen(read_ptr(ptr, 0, TP))
+                masktype = lltype.typeOf(bitmask)
+                value = rffi.cast(masktype, value)
+                current = rffi.cast(masktype, read_ptr(ptr, 0, TP))
                 current &= ~(bitmask << lowbit)
                 current |= (value & bitmask) << lowbit
                 value = rffi.cast(TP, current)
@@ -309,7 +310,8 @@
             if numbits:
                 lowbit = LOW_BIT(bitsize)
                 bitmask = BIT_MASK(numbits, ll_t)
-                value = widen(value)
+                masktype = lltype.typeOf(bitmask)
+                value = rffi.cast(masktype, value)
                 value >>= lowbit
                 value &= bitmask
                 if ll_t is lltype.Bool or signedtype(ll_t._type):


More information about the pypy-commit mailing list