]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
working fold_op_cmp implementation
authorWolfgang Bumiller <wry.git@bumiller.com>
Tue, 12 Nov 2013 15:15:02 +0000 (16:15 +0100)
committerWolfgang Bumiller <wry.git@bumiller.com>
Tue, 12 Nov 2013 15:15:02 +0000 (16:15 +0100)
fold.c

diff --git a/fold.c b/fold.c
index 7c2f66cf19f14e560be457c5ea5111e7388368b8..bd06737e245593d1fee766820980d731da70bc11 100644 (file)
--- a/fold.c
+++ b/fold.c
@@ -606,11 +606,10 @@ static GMQCC_INLINE ast_expression *fold_op_lteqgt(fold_t *fold, ast_value *a, a
 
 static GMQCC_INLINE ast_expression *fold_op_cmp(fold_t *fold, ast_value *a, ast_value *b, bool ne) {
     if (fold_can_2(a, b)) {
-        return fold_constgen_float(
-                    fold,
-                    (ne) ? (fold_immvalue_float(a) != fold_immvalue_float(b))
-                         : (fold_immvalue_float(a) == fold_immvalue_float(b))
-                );
+        if (isfloat(a) && isfloat(b))
+            return fold_constgen_float(fold, ne != (fold_immvalue_float(a) == fold_immvalue_float(b)));
+        if (isvector(a) && isvector(b))
+            return fold_constgen_float(fold, ne != vec3_cmp(fold_immvalue_vector(a), fold_immvalue_vector(b)));
     }
     return NULL;
 }