[hackers] [scc] Convert integerop(), numericaluop() and integeruop() to new type fields || Roberto E. Vargas Caballero
commit 11f2fad7a2d1dfb01db4048b86f48c9762909587
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 7 19:20:17 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jan 8 10:49:29 2016 +0100
Convert integerop(), numericaluop() and integeruop() to new type fields
diff --git a/cc1/expr.c b/cc1/expr.c
index a46d535..211d98a 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -204,7 +204,7 @@ decay(Node *np)
static Node *
integerop(char op, Node *lp, Node *rp)
{
- if (BTYPE(lp) != INT || BTYPE(rp) != INT)
+ if (!lp->type->integer || !rp->type->integer)
error("operator requires integer operands");
arithconv(&lp, &rp);
return simplify(op, lp->type, lp, rp);
_AT_@ -213,24 +213,20 @@ integerop(char op, Node *lp, Node *rp)
static Node *
numericaluop(char op, Node *np)
{
- switch (BTYPE(np)) {
- case INT:
- np = promote(np);
- case FLOAT:
- if (op == ONEG && np->op == ONEG)
- return np->left;
- if (op == OADD)
- return np;
- return simplify(op, np->type, np, NULL);
- default:
+ if (!np->type->arith)
error("unary operator requires numerical operand");
- }
+ np = promote(np);
+ if (op == ONEG && np->op == ONEG)
+ return np->left;
+ if (op == OADD)
+ return np;
+ return simplify(op, np->type, np, NULL);
}
static Node *
integeruop(char op, Node *np)
{
- if (BTYPE(np) != INT)
+ if (!np->type->integer)
error("unary operator requires integer operand");
np = promote(np);
if (op == OCPL && np->op == OCPL)
Received on Fri Jan 08 2016 - 13:13:58 CET
This archive was generated by hypermail 2.3.0
: Fri Jan 08 2016 - 13:24:31 CET