git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1103
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+ // check if we have to promote to long
if (SPEC_LONG (val->type) ||
(SPEC_USIGN(val->type) && sval>0xffff) ||
if (SPEC_LONG (val->type) ||
(SPEC_USIGN(val->type) && sval>0xffff) ||
- (!SPEC_USIGN(val->type) && ((long)sval>32767 || (long)sval<-32768)) {
+ (!SPEC_USIGN(val->type) && ((long)sval>32767 || (long)sval<-32768))) {
if (SPEC_USIGN (val->type))
SPEC_CVAL (val->type).v_ulong = sval;
else
SPEC_CVAL (val->type).v_long = sval;
SPEC_LONG (val->type) = 1;
if (SPEC_USIGN (val->type))
SPEC_CVAL (val->type).v_ulong = sval;
else
SPEC_CVAL (val->type).v_long = sval;
SPEC_LONG (val->type) = 1;
+
+ if (SPEC_USIGN (val->type))
+ SPEC_CVAL (val->type).v_uint = sval;
- {
- if (SPEC_USIGN (val->type))
- SPEC_CVAL (val->type).v_uint = sval;
- else
- SPEC_CVAL (val->type).v_int = sval;
- }
-
- // check the size and make it a char if possible
- if (sval < 256)
+ SPEC_CVAL (val->type).v_int = sval;
+
+
+ // check if we can make it a char
+ if ((SPEC_USIGN(val->type) && sval < 256) ||
+ (!SPEC_USIGN(val->type) && ((long)sval<127 && (long)sval>-128))) {
SPEC_NOUN (val->etype) = V_CHAR;
SPEC_NOUN (val->etype) = V_CHAR;
/*! /fn char hexEscape(char **src)
/param src Pointer to 'x' from start of hex character value
/*! /fn char hexEscape(char **src)
/param src Pointer to 'x' from start of hex character value