From: johanknol Date: Mon, 15 Oct 2001 13:05:05 +0000 (+0000) Subject: %lf doesn't recognize 0x1234 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=eadbf2f4a849754ca3715733827b1e9c6e5ae8a1;p=fw%2Fsdcc %lf doesn't recognize 0x1234 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1405 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 62b3a119..0caa5b2f 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -24,6 +24,7 @@ #include "common.h" #include "newalloc.h" +#include "math.h" /*-----------------------------------------------------------------*/ /* global variables */ @@ -41,12 +42,6 @@ int scopeLevel; symbol *returnLabel; /* function return label */ symbol *entryLabel; /* function entry label */ -#if defined(__BORLANDC__) || defined(_MSC_VER) -#define LONG_LONG __int64 -#else -#define LONG_LONG long long -#endif - /*-----------------------------------------------------------------*/ /* forward definition of some functions */ operand *geniCodeDivision (operand *, operand *); @@ -132,12 +127,14 @@ iCodeTable codeTable[] = */ void checkConstantRange(sym_link *ltype, value *val, char *msg, int pedantic) { - LONG_LONG max = (LONG_LONG) 1 << bitsForType(ltype); + double max; char message[132]=""; int warnings=0; int negative=0; long v; + max = pow ((double)2.0, (double)bitsForType(ltype)); + if (SPEC_LONG(val->type)) { v=SPEC_CVAL(val->type).v_long; } else { diff --git a/src/SDCCval.c b/src/SDCCval.c index 9dadb1fb..3b711c54 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -29,12 +29,6 @@ #include #include "newalloc.h" -#if defined(__BORLANDC__) || defined(_MSC_VER) -#define LONG_LONG __int64 -#else -#define LONG_LONG long long -#endif - int cNestLevel; /*-----------------------------------------------------------------*/ @@ -425,7 +419,7 @@ value *constVal (char *s) short hex = 0, octal = 0; char scanFmt[10]; int scI = 0; - double sval; + long sval; val = newValue (); /* alloc space for value */ @@ -446,7 +440,6 @@ value *constVal (char *s) scanFmt[scI++] = '%'; scanFmt[scI++] = 'l'; - scanFmt[scI++] = 'f'; if (octal) scanFmt[scI++] = 'o';