From: Wolfgang Bumiller Date: Tue, 12 Nov 2013 15:15:02 +0000 (+0100) Subject: working fold_op_cmp implementation X-Git-Tag: xonotic-v0.8.0~95 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=eb4486a7accdcb9af2328ee8843b68154373b9b5;p=xonotic%2Fgmqcc.git working fold_op_cmp implementation --- 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; }