summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2011-08-28 18:49:00 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2011-08-28 18:49:00 +0400
commit5abbe375cfc44a539347c8b409b443aa47be7cdf (patch)
tree0046ba94900ae584272647a9878646f167d19417 /parser.c
parent447e20cf96afdd369c7ee94301a55a39f0ca2d24 (diff)
downloadnasm-5abbe375cfc44a539347c8b409b443aa47be7cdf.tar.gz
nasm-5abbe375cfc44a539347c8b409b443aa47be7cdf.tar.bz2
nasm-5abbe375cfc44a539347c8b409b443aa47be7cdf.zip
Add IS_SREG and IS_FSGS helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/parser.c b/parser.c
index 8cbb49c..5ca9f86 100644
--- a/parser.c
+++ b/parser.c
@@ -218,10 +218,12 @@ restart_parse:
return result;
}
- if (i != TOKEN_ID && i != TOKEN_INSN && i != TOKEN_PREFIX &&
- (i != TOKEN_REG || (REG_SREG & ~nasm_reg_flags[tokval.t_integer]))) {
- nasm_error(ERR_NONFATAL, "label or instruction expected"
- " at start of line");
+ if (i != TOKEN_ID &&
+ i != TOKEN_INSN &&
+ i != TOKEN_PREFIX &&
+ (i != TOKEN_REG || !IS_SREG(tokval.t_integer))) {
+ nasm_error(ERR_NONFATAL,
+ "label or instruction expected at start of line");
result->opcode = I_none;
return result;
}
@@ -261,8 +263,7 @@ restart_parse:
result->times = 1L;
while (i == TOKEN_PREFIX ||
- (i == TOKEN_REG && !(REG_SREG & ~nasm_reg_flags[tokval.t_integer])))
- {
+ (i == TOKEN_REG && IS_SREG(tokval.t_integer))) {
first = false;
/*
@@ -661,15 +662,16 @@ is_expression:
/*
* Process the segment override.
*/
- if (value[1].type != 0 || value->value != 1 ||
- REG_SREG & ~nasm_reg_flags[value->type])
+ if (value[1].type != 0 ||
+ value->value != 1 ||
+ !IS_SREG(value->type))
nasm_error(ERR_NONFATAL, "invalid segment override");
else if (result->prefixes[PPS_SEG])
nasm_error(ERR_NONFATAL,
"instruction has conflicting segment overrides");
else {
result->prefixes[PPS_SEG] = value->type;
- if (!(REG_FSGS & ~nasm_reg_flags[value->type]))
+ if (IS_FSGS(value->type))
result->oprs[operand].eaflags |= EAF_FSGS;
}