From 1900262df431cecdef59970c2d90a4c87061650a Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Wed, 13 Nov 2013 04:57:18 -0500 Subject: [PATCH] Use a branch instead of math on enum types --- parser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parser.c b/parser.c index 2dc2550..f030572 100644 --- a/parser.c +++ b/parser.c @@ -476,7 +476,10 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy) type_name[exprs[0]->vtype]); return false; } - out = (ast_expression*)ast_unary_new(ctx, (VINSTR_NEG_F-TYPE_FLOAT) + exprs[0]->vtype, exprs[0]); + if (exprs[0]->vtype == TYPE_FLOAT) + out = (ast_expression*)ast_unary_new(ctx, VINSTR_NEG_F, exprs[0]); + else + out = (ast_expression*)ast_unary_new(ctx, VINSTR_NEG_V, exprs[0]); break; case opid2('!','P'):