]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
folder: fix -fperl-logic
authorWolfgang Bumiller <wry.git@bumiller.com>
Tue, 12 Nov 2013 13:39:25 +0000 (14:39 +0100)
committerWolfgang Bumiller <wry.git@bumiller.com>
Tue, 12 Nov 2013 13:39:25 +0000 (14:39 +0100)
fold.c

diff --git a/fold.c b/fold.c
index cd827bc5aa1d376913e50565282c33bf449e97bf..735758cb688c8fe48feee99980996547bf40e696 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -563,8 +563,10 @@ static GMQCC_INLINE ast_expression *fold_op_rshift(fold_t *fold, ast_value *a, a
 static GMQCC_INLINE ast_expression *fold_op_andor(fold_t *fold, ast_value *a, ast_value *b, float expr) {
     if (fold_can_2(a, b)) {
         if (OPTS_FLAG(PERL_LOGIC)) {
-            if (fold_immediate_true(fold, a))
-                return (ast_expression*)b;
+            if (expr)
+                return (fold_immediate_true(fold, a)) ? (ast_expression*)a : (ast_expression*)b;
+            else
+                return (fold_immediate_true(fold, a)) ? (ast_expression*)b : (ast_expression*)a;
         } else {
             return fold_constgen_float (
                 fold,