[pypy-commit] pypy win64-stage1: adjusted the format code of gc (long->Signed)

ctismer noreply at buildbot.pypy.org
Fri Dec 2 00:21:21 CET 2011


Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r50049:7f97cc73d700
Date: 2011-12-02 00:20 +0100
http://bitbucket.org/pypy/pypy/changeset/7f97cc73d700/

Log:	adjusted the format code of gc (long->Signed)

diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -576,7 +576,7 @@
         # if convenient for the backend, we compute the info about
         # the flag as (byte-offset, single-byte-flag).
         import struct
-        value = struct.pack("l", flag_word)
+        value = struct.pack(lltype.SignedFmt, flag_word)
         assert value.count('\x00') == len(value) - 1    # only one byte is != 0
         i = 0
         while value[i] == '\x00': i += 1
diff --git a/pypy/rpython/lltypesystem/lltype.py b/pypy/rpython/lltypesystem/lltype.py
--- a/pypy/rpython/lltypesystem/lltype.py
+++ b/pypy/rpython/lltypesystem/lltype.py
@@ -8,7 +8,7 @@
 from pypy.tool.identity_dict import identity_dict
 from pypy.tool import leakfinder
 from types import NoneType
-from pypy.rlib.rarithmetic import maxint, is_valid_int
+from pypy.rlib.rarithmetic import maxint, is_valid_int, is_emulated_long
 import weakref
 
 class State(object):
@@ -682,6 +682,11 @@
     number = _numbertypes[type] = Number(name, type)
     return number
 
+if is_emulated_long:
+    SignedFmt = 'll'
+else:
+    SignedFmt = 'l'
+
 Signed   = build_number("Signed", int)
 Unsigned = build_number("Unsigned", r_uint)
 SignedLongLong = build_number("SignedLongLong", r_longlong)


More information about the pypy-commit mailing list