[pypy-svn] pypy fast-forward: Some translation fixes

amauryfa commits-noreply at bitbucket.org
Thu Dec 30 01:30:23 CET 2010


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40273:bcee09b348dd
Date: 2010-12-30 01:33 +0100
http://bitbucket.org/pypy/pypy/changeset/bcee09b348dd/

Log:	Some translation fixes

diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -252,6 +252,7 @@
         return True
     else:
         return t.SIGNED
+signedtype._annspecialcase_ = 'specialize:memo'
 
 def normalizedinttype(t):
     if t is int:

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
@@ -17,7 +17,7 @@
 from pypy.module._rawffi.interp_rawffi import size_alignment, LL_TYPEMAP
 from pypy.module._rawffi.interp_rawffi import unroll_letters_for_numbers
 from pypy.rlib import clibffi
-from pypy.rlib.rarithmetic import intmask, r_uint
+from pypy.rlib.rarithmetic import intmask, r_uint, signedtype
 
 def unpack_fields(space, w_fields):
     fields_w = space.unpackiterable(w_fields)
@@ -255,7 +255,7 @@
                 bitmask = BIT_MASK(numbits)
                 current &= ~ (bitmask << lowbit)
                 current |= (value & bitmask) << lowbit
-                value = current
+                value = rffi.cast(TP, current)
             break
 
     rffi.cast(T, ptr)[0] = value
@@ -273,7 +273,7 @@
             numbits = NUM_BITS(bitsize)
             lowbit = LOW_BIT(bitsize)
             if numbits:
-                if ll_t._type.SIGN:
+                if ll_t is lltype.Bool or signedtype(ll_t._type):
                     value >>= lowbit
                     sign = (value >> (numbits - 1)) & 1
                     value &= BIT_MASK(numbits - 1)


More information about the Pypy-commit mailing list