Author: Brian Kearns <[email protected]>
Branch: stdlib-2.7.6
Changeset: r69661:f2b3b189bc4f
Date: 2014-03-04 02:03 -0500
http://bitbucket.org/pypy/pypy/changeset/f2b3b189bc4f/
Log: fix rawffi
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
@@ -16,7 +16,7 @@
from pypy.module._rawffi.interp_rawffi import read_ptr, write_ptr
from rpython.rlib import clibffi, rgc
from rpython.rlib.rarithmetic import intmask, signedtype, widen, r_uint, \
- r_longlong, r_ulonglong
+ r_ulonglong
from rpython.rtyper.lltypesystem import lltype, rffi
@@ -269,12 +269,10 @@
return x >> 16
def BIT_MASK(x, ll_t):
- if ll_t is lltype.SignedLongLong:
- one = r_longlong(1)
- elif ll_t is lltype.UnsignedLongLong:
+ if ll_t is lltype.SignedLongLong or ll_t is lltype.UnsignedLongLong:
one = r_ulonglong(1)
else:
- one = 1
+ one = r_uint(1)
# to avoid left shift by x == sizeof(ll_t)
return (((one << (x - 1)) - 1) << 1) + 1
BIT_MASK._annspecialcase_ = 'specialize:arg(1)'
@@ -317,8 +315,7 @@
if ll_t is lltype.Bool or signedtype(ll_t._type):
sign = (value >> (numbits - 1)) & 1
if sign:
- one = r_longlong(1) if ll_t is lltype.SignedLongLong
else 1
- value = value - (one << numbits)
+ value -= bitmask + 1
value = rffi.cast(ll_t, value)
break
return value
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit