From eb4486a7accdcb9af2328ee8843b68154373b9b5 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 12 Nov 2013 16:15:02 +0100 Subject: [PATCH] working fold_op_cmp implementation --- fold.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fold.c b/fold.c index 7c2f66c..bd06737 100644 --- 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; } -- 2.39.2