]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
Actually generate an ast_call for __builtin_pow for the ** operator, otherwise the...
[xonotic/gmqcc.git] / parser.c
index b97d92c3896ee0d26fb9c3a240afc7da2e02bf9b..6ab55e33116a0745f5de8a789fcab43fccb2c03a 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1086,7 +1086,10 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
             if (CanConstFold(exprs[0], exprs[1])) {
                 out = (ast_expression*)parser_const_float(parser, powf(ConstF(0), ConstF(1)));
             } else {
-                out = parser_builtin_pow(parser);
+                ast_call *gencall = ast_call_new(parser_ctx(parser), parser_builtin_pow(parser));
+                vec_push(gencall->params, exprs[0]);
+                vec_push(gencall->params, exprs[1]);
+                out = (ast_expression*)gencall;
             }
             break;
 
@@ -1435,7 +1438,8 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
             if(CanConstFold1(exprs[0]))
                 out = (ast_expression*)parser_const_float(parser, ~(qcint)ConstF(0));
             else
-                out = (ast_expression*)ast_binary_new(ctx, INSTR_SUB_F, (ast_expression*)parser_const_float_neg1(parser), exprs[0]);
+                out = (ast_expression*)
+                    ast_binary_new(ctx, INSTR_SUB_F, (ast_expression*)parser_const_float_neg1(parser), exprs[0]);
             break;
     }
 #undef NotSameType