]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
&=~ vector not that we need it
authorRudolf Polzer <divverent@xonotic.org>
Mon, 26 Aug 2013 10:52:34 +0000 (12:52 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 26 Aug 2013 10:52:46 +0000 (12:52 +0200)
parser.c

index 0476820f51384c27faab16f77a33be0bd1dd7fcd..9ed80431364fc6b04692362effdad2bfd265dfcf 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1057,7 +1057,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
              * But QC has no bitwise-not, so we implement it as
              * a -= a & (b);
              */
-            if (NotSameType(TYPE_FLOAT)) {
+            if (NotSameType(TYPE_FLOAT) && NotSameType(TYPE_VECTOR)) {
                 ast_type_to_string(exprs[0], ty1, sizeof(ty1));
                 ast_type_to_string(exprs[1], ty2, sizeof(ty2));
                 compile_error(ctx, "invalid types used in expression: %s and %s",
@@ -1068,13 +1068,19 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
                 assignop = type_storep_instr[exprs[0]->vtype];
             else
                 assignop = type_store_instr[exprs[0]->vtype];
-            out = (ast_expression*)ast_binary_new(ctx, INSTR_BITAND, exprs[0], exprs[1]);
+            if (exprs[0]->vtype == TYPE_FLOAT)
+                out = (ast_expression*)ast_binary_new(ctx, INSTR_BITAND, exprs[0], exprs[1]);
+            else
+                out = (ast_expression*)ast_binary_new(ctx, VINSTR_BITAND_V, exprs[0], exprs[1]);
             if (!out)
                 return false;
             if (ast_istype(exprs[0], ast_value) && asvalue[0]->cvq == CV_CONST) {
                 compile_error(ctx, "assignment to constant `%s`", asvalue[0]->name);
             }
-            asbinstore = ast_binstore_new(ctx, assignop, INSTR_SUB_F, exprs[0], out);
+            if (exprs[0]->vtype == TYPE_FLOAT)
+                asbinstore = ast_binstore_new(ctx, assignop, INSTR_SUB_F, exprs[0], out);
+            else
+                asbinstore = ast_binstore_new(ctx, assignop, INSTR_SUB_V, exprs[0], out);
             asbinstore->keep_dest = true;
             out = (ast_expression*)asbinstore;
             break;