]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - fold.c
Fix folding logic for conditions.
[xonotic/gmqcc.git] / fold.c
diff --git a/fold.c b/fold.c
index 360b4f0f86e0cbd5866f2e6dc6fb5f5a0b8533e3..f8a143ceb7f7f4ab772c99323d7a96336965bf84 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -765,7 +765,7 @@ int fold_cond(ir_value *condval, ast_function *func, ast_ifthen *branch) {
         ast_expression_codegen *cgen;
         ir_block               *elide;
         ir_value               *dummy;
-        bool                    istrue  = (fold_immvalue_float(condval) == 1.0f && branch->on_true);
+        bool                    istrue  = (fold_immvalue_float(condval) != 0.0f && branch->on_true);
         bool                    isfalse = (fold_immvalue_float(condval) == 0.0f && branch->on_false);
         ast_expression         *path    = (istrue)  ? branch->on_true  :
                                           (isfalse) ? branch->on_false : NULL;