mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 22:22:17 +00:00
working fold_op_cmp implementation
This commit is contained in:
parent
1d5229ee8c
commit
eb4486a7ac
1 changed files with 4 additions and 5 deletions
9
fold.c
9
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue