From: Dale Weiler Date: Thu, 29 Aug 2013 04:18:48 +0000 (-0400) Subject: Fix folding logic for conditions. X-Git-Tag: 0.3.5~120 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=51ef277e210afeace2c1500f4c22c17b8e47d2d5 Fix folding logic for conditions. --- diff --git a/fold.c b/fold.c index 360b4f0..f8a143c 100644 --- 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;