[pypy-commit] pypy stdlib-2.7.6: need this for 32bit
bdkearns
noreply at buildbot.pypy.org
Mon Mar 3 22:35:21 CET 2014
Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.6
Changeset: r69642:35362e167655
Date: 2014-03-03 16:34 -0500
http://bitbucket.org/pypy/pypy/changeset/35362e167655/
Log: need this for 32bit
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
@@ -15,7 +15,7 @@
from pypy.module._rawffi.interp_rawffi import size_alignment
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
+from rpython.rlib.rarithmetic import intmask, signedtype, widen, r_uint, r_longlong
from rpython.rtyper.lltypesystem import lltype, rffi
@@ -309,7 +309,8 @@
if ll_t is lltype.Bool or signedtype(ll_t._type):
sign = (value >> (numbits - 1)) & 1
if sign:
- value = value - (1 << numbits)
+ one = r_longlong(1) if ll_t is lltype.SignedLongLong else 1
+ value = value - (one << numbits)
value = rffi.cast(ll_t, value)
break
return value
More information about the pypy-commit
mailing list