summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
790a8ac)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1495
4a8a32a2-be11-0410-ad9d-
d568d2c75423
short hex = 0, octal = 0;
char scanFmt[10];
int scI = 0;
short hex = 0, octal = 0;
char scanFmt[10];
int scI = 0;
val = newValue (); /* alloc space for value */
val = newValue (); /* alloc space for value */
else if (hex)
scanFmt[scI++] = 'x';
else
else if (hex)
scanFmt[scI++] = 'x';
else
- sscanf (s, scanFmt, &sval);
+ if (octal || hex) {
+ unsigned long sval;
+ sscanf (s, scanFmt, &sval);
+ dval=sval;
+ } else {
+ sscanf (s, scanFmt, &dval);
+ }
/* Setup the flags first */
/* set the _long flag if 'lL' is found */
/* Setup the flags first */
/* set the _long flag if 'lL' is found */
SPEC_LONG (val->type) = 1;
}
SPEC_LONG (val->type) = 1;
}
- if (sval<0) { // "-28u" will still be signed and negative
+ if (dval<0) { // "-28u" will still be signed and negative
SPEC_USIGN (val->type) = 0;
SPEC_USIGN (val->type) = 0;
- if (sval<-128) { // check if we have to promote to int
+ if (dval<-128) { // check if we have to promote to int
SPEC_NOUN (val->type) = V_INT;
}
SPEC_NOUN (val->type) = V_INT;
}
- if (sval<-32768) { // check if we have to promote to long int
+ if (dval<-32768) { // check if we have to promote to long int
SPEC_LONG (val->type) = 1;
}
} else { // >=0
SPEC_LONG (val->type) = 1;
}
} else { // >=0
- if (sval>0xff) { // check if we have to promote to int
+ if (dval>0xff) { // check if we have to promote to int
SPEC_NOUN (val->type) = V_INT;
}
SPEC_NOUN (val->type) = V_INT;
}
- if (sval>0xffff) { // check if we have to promote to long int
+ if (dval>0xffff) { // check if we have to promote to long int
SPEC_LONG (val->type) = 1;
}
}
SPEC_LONG (val->type) = 1;
}
}
{
if (SPEC_USIGN (val->type))
{
{
if (SPEC_USIGN (val->type))
{
- SPEC_CVAL (val->type).v_ulong = sval;
+ SPEC_CVAL (val->type).v_ulong = dval;
- SPEC_CVAL (val->type).v_long = sval;
+ SPEC_CVAL (val->type).v_long = dval;
}
}
else
{
if (SPEC_USIGN (val->type))
{
}
}
else
{
if (SPEC_USIGN (val->type))
{
- SPEC_CVAL (val->type).v_uint = sval;
+ SPEC_CVAL (val->type).v_uint = dval;
- SPEC_CVAL (val->type).v_int = sval;
+ SPEC_CVAL (val->type).v_int = dval;