+
+#else
+
+static value *cheapestVal (value *val)
+{
+ /* - signed/unsigned must no be changed.
+ - long must not be changed.
+
+ the only possible reduction is from signed int to signed char,
+ because it's automatically promoted back to signed int.
+
+ a reduction from unsigned int to unsigned char is a bug,
+ because an _unsigned_ char is promoted to _signed_ int! */
+ if (IS_INT(val->type) &&
+ !SPEC_USIGN(val->type) &&
+ !SPEC_LONG(val->type) &&
+ SPEC_CVAL(val->type).v_int >= -128 &&
+ SPEC_CVAL(val->type).v_int <= 127)
+
+ {
+ SPEC_NOUN(val->type) = V_CHAR;
+ }
+ /* this could be too aggressive:
+ 'unsigned char' promotes to 'signed int', so that we can
+ reduce it the other way */
+ if (IS_INT(val->type) &&
+ !SPEC_USIGN(val->type) &&
+ !SPEC_LONG(val->type) &&
+ SPEC_CVAL(val->type).v_int >= 128 &&
+ SPEC_CVAL(val->type).v_int <= 255)
+
+ {
+ SPEC_NOUN(val->type) = V_CHAR;
+ SPEC_USIGN(val->type) = 1;
+ }
+ return (val);
+}