%lf doesn't recognize 0x1234
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 15 Oct 2001 13:05:05 +0000 (13:05 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 15 Oct 2001 13:05:05 +0000 (13:05 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1405 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCicode.c
src/SDCCval.c

index 62b3a119b11e94d8141a84a725a0f57bac9940f2..0caa5b2f9643a03d7bfa94523173ded256709600 100644 (file)
@@ -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 {
index 9dadb1fb3b503b345f2f447aac0ff1e51f5a43c1..3b711c542394f3e45221643addc746e70f04d0d7 100644 (file)
 #include <limits.h>
 #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';