1. Pypy
  2. Untitled project
  3. pypy

Commits

Armin Rigo  committed f04538f

Hack more to make it work on 32-bit.

  • Participants
  • Parent commits d54591c
  • Branches kill-someobject

Comments (0)

Files changed (1)

File pypy/translator/c/test/test_genc.py

View file
 from pypy.translator.interactive import Translation
 from pypy.translator.translator import TranslationContext, graphof
 
+signed_ffffffff = r_longlong(0xffffffff)
+unsigned_ffffffff = r_ulonglong(0xffffffff)
+
 def llrepr(v):
     if isinstance(v, r_ulonglong):
-        return "%d:%d" % (intmask(v >> 32), intmask(v & 0xffffffff))
+        return "%d:%d" % (intmask(v >> 32), intmask(v & unsigned_ffffffff))
     elif isinstance(v, r_longlong):
-        return "%d:%d" % (intmask(v >> 32), intmask(v & 0xffffffff))
+        return "%d:%d" % (intmask(v >> 32), intmask(v & signed_ffffffff))
     return str(v)
 
 def parse_longlong(a):
     p0, p1 = a.split(":")
-    return (r_longlong(int(p0)) << 32) + (r_longlong(int(p1)) & 0xffffffff)
+    return (r_longlong(int(p0)) << 32) + (r_longlong(int(p1)) &
+                                          signed_ffffffff)
 
 def parse_ulonglong(a):
     p0, p1 = a.split(":")
-    return (r_ulonglong(int(p0)) << 32) + (r_ulonglong(int(p1)) & 0xffffffff)
+    return (r_ulonglong(int(p0)) << 32) + (r_ulonglong(int(p1)) &
+                                           unsigned_ffffffff)
 
 def compile(fn, argtypes, view=False, gcpolicy="none", backendopt=True,
             annotatorpolicy=None, thread=False):
         for arg, argtype in zip(args, argtypes):
             assert isinstance(arg, argtype)
         stdout = t.driver.cbuilder.cmdexec(" ".join([llrepr(arg) for arg in args]))
+        print stdout
         assert stdout.endswith(' ;\n')
         pos = stdout.rindex('THE RESULT IS: ')
         res = stdout[pos + len('THE RESULT IS: '):-3]