From: Julian Seward Date: Mon, 22 Nov 2004 12:55:45 +0000 (+0000) Subject: Make VEX's "Char" type always be signed, so as to bring it into line X-Git-Tag: svn/VALGRIND_3_0_1^2~756 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30ca18634a80ef2d03c4c9082dc28336dbf33fff;p=thirdparty%2Fvalgrind.git Make VEX's "Char" type always be signed, so as to bring it into line with Valgrind conventions. git-svn-id: svn://svn.valgrind.org/vex/trunk@578 --- diff --git a/VEX/priv/guest-x86/ghelpers.c b/VEX/priv/guest-x86/ghelpers.c index df50144749..5ea6410f19 100644 --- a/VEX/priv/guest-x86/ghelpers.c +++ b/VEX/priv/guest-x86/ghelpers.c @@ -1731,12 +1731,12 @@ static inline Short qadd16S ( Short xx, Short yy ) return (Short)t; } -static inline SChar qadd8S ( SChar xx, SChar yy ) +static inline Char qadd8S ( Char xx, Char yy ) { Int t = ((Int)xx) + ((Int)yy); if (t < -128) t = -128; if (t > 127) t = 127; - return (SChar)t; + return (Char)t; } static inline UShort qadd16U ( UShort xx, UShort yy ) @@ -1761,12 +1761,12 @@ static inline Short qsub16S ( Short xx, Short yy ) return (Short)t; } -static inline SChar qsub8S ( SChar xx, SChar yy ) +static inline Char qsub8S ( Char xx, Char yy ) { Int t = ((Int)xx) - ((Int)yy); if (t < -128) t = -128; if (t > 127) t = 127; - return (SChar)t; + return (Char)t; } static inline UShort qsub16U ( UShort xx, UShort yy ) @@ -1823,7 +1823,7 @@ static inline UShort cmpge16S ( Short xx, Short yy ) return xx>yy ? 0xFFFF : 0; } -static inline UChar cmpge8S ( SChar xx, SChar yy ) +static inline UChar cmpge8S ( Char xx, Char yy ) { return xx>yy ? 0xFF : 0; } @@ -1836,12 +1836,12 @@ static inline Short qnarrow32Sto16 ( UInt xx0 ) return (Short)xx; } -static inline SChar qnarrow16Sto8 ( UShort xx0 ) +static inline Char qnarrow16Sto8 ( UShort xx0 ) { Short xx = (Short)xx0; if (xx < -128) xx = -128; if (xx > 127) xx = 127; - return (SChar)xx; + return (Char)xx; } static inline UChar qnarrow16Uto8 ( UShort xx0 ) diff --git a/VEX/priv/host-x86/hdefs.c b/VEX/priv/host-x86/hdefs.c index 98e924ccda..d5476feff3 100644 --- a/VEX/priv/host-x86/hdefs.c +++ b/VEX/priv/host-x86/hdefs.c @@ -109,7 +109,7 @@ void getAllocableRegs_X86 ( Int* nregs, HReg** arr ) /* --------- Condition codes, Intel encoding. --------- */ -Char* showX86CondCode ( X86CondCode cond ) +HChar* showX86CondCode ( X86CondCode cond ) { switch (cond) { case Xcc_O: return "o"; diff --git a/VEX/priv/host-x86/hdefs.h b/VEX/priv/host-x86/hdefs.h index 6e58701479..09dea16116 100644 --- a/VEX/priv/host-x86/hdefs.h +++ b/VEX/priv/host-x86/hdefs.h @@ -87,7 +87,7 @@ typedef } X86CondCode; -extern Char* showX86CondCode ( X86CondCode ); +extern HChar* showX86CondCode ( X86CondCode ); /* --------- Memory address expressions (amodes). --------- */ diff --git a/VEX/priv/main/vex_util.c b/VEX/priv/main/vex_util.c index 86f228f40d..d45b11cf8e 100644 --- a/VEX/priv/main/vex_util.c +++ b/VEX/priv/main/vex_util.c @@ -504,7 +504,7 @@ static void add_to_vg_sprintf_buf ( Char c ) *vg_sprintf_ptr++ = c; } -UInt vex_sprintf ( Char* buf, const Char *format, ... ) +UInt vex_sprintf ( Char* buf, const HChar *format, ... ) { Int ret; va_list vargs; diff --git a/VEX/priv/main/vex_util.h b/VEX/priv/main/vex_util.h index cb5a734416..021e4e0703 100644 --- a/VEX/priv/main/vex_util.h +++ b/VEX/priv/main/vex_util.h @@ -64,10 +64,10 @@ extern void vpanic ( Char* str ); /* Printing */ __attribute__ ((format (printf, 1, 2))) -extern UInt vex_printf ( const Char *format, ... ); +extern UInt vex_printf ( const HChar *format, ... ); __attribute__ ((format (printf, 2, 3))) -extern UInt vex_sprintf ( Char* buf, const Char *format, ... ); +extern UInt vex_sprintf ( Char* buf, const HChar *format, ... ); /* String ops */ diff --git a/VEX/pub/libvex_basictypes.h b/VEX/pub/libvex_basictypes.h index 7fe9157939..cf800c6e88 100644 --- a/VEX/pub/libvex_basictypes.h +++ b/VEX/pub/libvex_basictypes.h @@ -42,8 +42,10 @@ /* Always 8 bits. */ typedef unsigned char UChar; -typedef signed char SChar; -typedef char Char; /* platform-dependent signfulness */ +typedef signed char Char; +typedef char HChar; /* signfulness depends on host */ + /* Only to be used for printf etc + format strings */ /* Always 16 bits. */ typedef unsigned short UShort;