mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Allow fold_constants to handle some math identities
Such as x*0 -> 0, x*1 -> x, x+0 ->x, etc.
This commit is contained in:
parent
c98d1ff08c
commit
3196bcc851
1 changed files with 2 additions and 2 deletions
|
@ -1458,7 +1458,7 @@ fold_constants (expr_t *e)
|
||||||
|
|
||||||
if (e->type == ex_uexpr) {
|
if (e->type == ex_uexpr) {
|
||||||
e1 = e->e.expr.e1;
|
e1 = e->e.expr.e1;
|
||||||
if (!e1 || !is_constant (e1)) {
|
if (!e1) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
op = e->e.expr.op;
|
op = e->e.expr.op;
|
||||||
|
@ -1473,7 +1473,7 @@ fold_constants (expr_t *e)
|
||||||
} else if (e->type == ex_expr) {
|
} else if (e->type == ex_expr) {
|
||||||
e1 = e->e.expr.e1;
|
e1 = e->e.expr.e1;
|
||||||
e2 = e->e.expr.e2;
|
e2 = e->e.expr.e2;
|
||||||
if (!is_constant (e1) || !is_constant (e2)) {
|
if (!is_constant (e1) && !is_constant (e2)) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue