mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-29 12:27:09 +02:00
Optimize "- INT_CONSTANT" to be simply -INT_CONSTANT rather than (- INT_CONSTANT)
This commit is contained in:
@@ -2264,6 +2264,13 @@ static expr_node *parse_factor(char const **e, int *r, Var *locals, int level)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Optimize '-' followed by integer constant */
|
||||
if (op == '-' && node->type == N_CONSTANT) {
|
||||
if (node->u.value.type == INT_TYPE) {
|
||||
node->u.value.v.val = - node->u.value.v.val;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
factor_node = alloc_expr_node(r);
|
||||
if (!factor_node) {
|
||||
free_expr_tree(node);
|
||||
|
||||
Reference in New Issue
Block a user