summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-04-04 13:34:53 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-04-04 13:34:53 -0700
commit32cd4c2a62f34815dbc9c13e1e6640bb096d05b5 (patch)
treeb102f98dbf7c28e18f114f944c006ab7499a2904 /parser.c
parent5a7976c925e494bfd0db806c5f5724157236b4e3 (diff)
downloadnasm-32cd4c2a62f34815dbc9c13e1e6640bb096d05b5.tar.gz
nasm-32cd4c2a62f34815dbc9c13e1e6640bb096d05b5.tar.bz2
nasm-32cd4c2a62f34815dbc9c13e1e6640bb096d05b5.zip
Correctly identify SBYTE in the optimizer
Correctly identify SBYTE in the optimizer, *HOWEVER*, this change will cause nuisance warnings to be issued; that will have to be fixed.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/parser.c b/parser.c
index 5983af5..9172fb1 100644
--- a/parser.c
+++ b/parser.c
@@ -797,9 +797,16 @@ restart_parse:
result->oprs[operand].type |= UNITY;
if (optimizing >= 0 &&
!(result->oprs[operand].type & STRICT)) {
- if (reloc_value(value) >= -128 &&
- reloc_value(value) <= 127)
- result->oprs[operand].type |= SBYTE;
+ int64_t v64 = reloc_value(value);
+ int32_t v32 = (int32_t)v64;
+ int16_t v16 = (int16_t)v32;
+
+ if (v64 >= -128 && v64 <= 127)
+ result->oprs[operand].type |= SBYTE64;
+ if (v32 >= -128 && v32 <= 127)
+ result->oprs[operand].type |= SBYTE32;
+ if (v16 >= -128 && v16 <= 127)
+ result->oprs[operand].type |= SBYTE16;
}
}
} else { /* it's a register */