]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Use a branch instead of math on enum types
authorDale Weiler <cube2killfield@gmail.com>
Wed, 13 Nov 2013 09:57:18 +0000 (04:57 -0500)
committerDale Weiler <cube2killfield@gmail.com>
Wed, 13 Nov 2013 09:57:18 +0000 (04:57 -0500)
parser.c

index 2dc25508449e2771220d08d5907c3f01799fb183..f03057266d3c71bc37233ffc3e012086192f9451 100644 (file)
--- 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;
             }
                                   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'):
             break;
 
         case opid2('!','P'):