From: johanknol Date: Sat, 6 Oct 2001 09:48:26 +0000 (+0000) Subject: fixed valCastLiteral() X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=8267713fa4d12bfd5d6a96aa21a894b7579854d5;p=fw%2Fsdcc fixed valCastLiteral() git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1359 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCval.c b/src/SDCCval.c index 3eeb7d2b..c540a4fe 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -1433,9 +1433,17 @@ valCastLiteral (sym_link * dtype, double fval) else { if (SPEC_USIGN (val->etype)) - SPEC_CVAL (val->etype).v_uint = (unsigned int) fval; + if (SPEC_NOUN (val->etype)==V_CHAR) { + SPEC_CVAL (val->etype).v_uint = (unsigned char) fval; + } else { + SPEC_CVAL (val->etype).v_uint = (unsigned int) fval; + } else - SPEC_CVAL (val->etype).v_int = (int) fval; + if (SPEC_NOUN (val->etype)==V_CHAR) { + SPEC_CVAL (val->etype).v_int = (char) fval; + } else { + SPEC_CVAL (val->etype).v_int = (int) fval; + } } } return val;