Fixed up more warnings
[fw/sdcc] / src / SDCCval.c
index 8d65e07fb5d6e64e999ead39c2080ebf4b080e33..86de5525be63e892b658735dfee21d855529e1d0 100644 (file)
@@ -348,10 +348,9 @@ value *cheapestVal (value *val) {
     if (sval<0) {
       if (sval>=-32768) {
        SPEC_LONG(val->type)=0;
-       SPEC_CVAL(val->type).v_int = sval & 0xffff;
+       SPEC_CVAL(val->type).v_int = sval;
        if (sval>=-128) {
          SPEC_NOUN(val->type)=V_CHAR;
-         SPEC_CVAL(val->type).v_int &= 0xff;
        }
       }
     } else { // sval>=0
@@ -890,17 +889,10 @@ floatFromVal (value * val)
        return (double) SPEC_CVAL (val->etype).v_long;
     }
   
-  if (SPEC_NOUN(val->etype)==V_INT) {
-    if (SPEC_USIGN (val->etype))
-      return (double) SPEC_CVAL (val->etype).v_uint;
-    else
-      return (double) SPEC_CVAL (val->etype).v_int;
-  } else { // SPEC_NOUN==V_CHAR
-    if (SPEC_USIGN (val->etype))
-      return (double) ((unsigned char)SPEC_CVAL (val->etype).v_uint);
-    else
-      return (double) ((signed char)SPEC_CVAL (val->etype).v_int);
-  }
+  if (SPEC_USIGN (val->etype))
+    return (double) SPEC_CVAL (val->etype).v_uint;
+  else
+    return (double) SPEC_CVAL (val->etype).v_int;
 }
 
 
@@ -928,9 +920,6 @@ valUnaryPM (value * val)
            SPEC_CVAL (val->etype).v_uint = 0-SPEC_CVAL (val->etype).v_uint;
          else
            SPEC_CVAL (val->etype).v_int = -SPEC_CVAL (val->etype).v_int;
-         if (SPEC_NOUN (val->etype)==V_CHAR) {
-           SPEC_CVAL (val->etype).v_uint &= 0xff;
-         }
        }
     }
   // -(unsigned 3) now really is signed
@@ -958,9 +947,6 @@ valComplement (value * val)
        SPEC_CVAL (val->etype).v_uint = ~SPEC_CVAL (val->etype).v_uint;
       else
        SPEC_CVAL (val->etype).v_int = ~SPEC_CVAL (val->etype).v_int;
-      if (SPEC_NOUN (val->etype)==V_CHAR) {
-       SPEC_CVAL (val->etype).v_uint &= 0xff;
-      }
     }
   return val;
 }
@@ -985,9 +971,6 @@ valNot (value * val)
        SPEC_CVAL (val->etype).v_uint = !SPEC_CVAL (val->etype).v_uint;
       else
        SPEC_CVAL (val->etype).v_int = !SPEC_CVAL (val->etype).v_int;
-      if (SPEC_NOUN (val->etype)==V_CHAR) {
-       SPEC_CVAL (val->etype).v_uint &= 0xff;
-      }
     }
   return val;
 }
@@ -1433,9 +1416,6 @@ valCastLiteral (sym_link * dtype, double fval)
              SPEC_CVAL (val->etype).v_uint = (unsigned short)l;
          else
              SPEC_CVAL (val->etype).v_int = (short)l;
-         if (SPEC_NOUN (val->etype)==V_CHAR) {
-             SPEC_CVAL (val->etype).v_uint &= 0xff; 
-         }
       }
   }
   return val;