[pypy-svn] r35779 - pypy/dist/pypy/rpython/lltypesystem

mwh at codespeak.net mwh at codespeak.net
Fri Dec 15 11:09:53 CET 2006


Author: mwh
Date: Fri Dec 15 11:09:53 2006
New Revision: 35779

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rpbc.py
Log:
cast the function-representing char to an int before using it as an array index
(which worked when compiled to c, of course :-)


Modified: pypy/dist/pypy/rpython/lltypesystem/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rpbc.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rpbc.py	Fri Dec 15 11:09:53 2006
@@ -289,7 +289,10 @@
     def convert_from_to((r_from, r_to), v, llops):
         c_table = conversion_table(r_from, r_to)
         if c_table:
-            return llops.genop('getarrayitem', [c_table, v],
+            assert v.concretetype is Char
+            v_int = llops.genop('cast_char_to_int', [v],
+                                resulttype=Signed)
+            return llops.genop('getarrayitem', [c_table, v_int],
                                resulttype=Char)
         else:
             return v



More information about the Pypy-commit mailing list