From 8267713fa4d12bfd5d6a96aa21a894b7579854d5 Mon Sep 17 00:00:00 2001 From: johanknol Date: Sat, 6 Oct 2001 09:48:26 +0000 Subject: [PATCH] fixed valCastLiteral() git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1359 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCval.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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; -- 2.47.2