[pypy-svn] r15445 - pypy/dist/pypy/translator/c/src

arigo at codespeak.net arigo at codespeak.net
Sat Jul 30 22:35:51 CEST 2005


Author: arigo
Date: Sat Jul 30 22:35:50 2005
New Revision: 15445

Modified:
   pypy/dist/pypy/translator/c/src/int.h
Log:
Casting from char to int produced negative numbers if the compiler's chars are
signed.


Modified: pypy/dist/pypy/translator/c/src/int.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/int.h	(original)
+++ pypy/dist/pypy/translator/c/src/int.h	Sat Jul 30 22:35:50 2005
@@ -156,11 +156,11 @@
 #define OP_CAST_BOOL_TO_UINT(x,r,err)   r = (unsigned long)(x);
 #define OP_CAST_UINT_TO_INT(x,r,err)    r = (long)(x);
 #define OP_CAST_INT_TO_UINT(x,r,err)    r = (unsigned long)(x);
-#define OP_CAST_CHAR_TO_INT(x,r,err)    r = (long)(x);
+#define OP_CAST_CHAR_TO_INT(x,r,err)    r = (long)((unsigned char)(x));
 #define OP_CAST_INT_TO_CHAR(x,r,err)    r = (char)(x);
 #define OP_CAST_PTR_TO_INT(x,r,err)     r = (long)(x);    /* XXX */
 
-#define OP_CAST_UNICHAR_TO_INT(x,r,err)    r = (x);
+#define OP_CAST_UNICHAR_TO_INT(x,r,err)    r = (long)((unsigned long)(x)); /*?*/
 #define OP_CAST_INT_TO_UNICHAR(x,r,err)    r = (Py_UCS4)(x);
 
 /* bool operations */



More information about the Pypy-commit mailing list