[hackers] [scc] Interchange integeruop() and numericaluop() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 8 Jan 2016 13:13:58 +0100 (CET)

commit 0c094f48799666e4e0c82aed4fd817f69a3f3f6e
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jan 7 19:21:56 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jan 8 10:49:29 2016 +0100

    Interchange integeruop() and numericaluop()
    
    This change puts integeruop() after integerop(), which
    simplifies reading the code, because it puts together
    related functions.

diff --git a/cc1/expr.c b/cc1/expr.c
index 211d98a..dc6c9b5 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -211,26 +211,26 @@ integerop(char op, Node *lp, Node *rp)
 }
 
 static Node *
-numericaluop(char op, Node *np)
+integeruop(char op, Node *np)
 {
- if (!np->type->arith)
- error("unary operator requires numerical operand");
+ if (!np->type->integer)
+ error("unary operator requires integer operand");
         np = promote(np);
- if (op == ONEG && np->op == ONEG)
+ if (op == OCPL && np->op == OCPL)
                 return np->left;
- if (op == OADD)
- return np;
         return simplify(op, np->type, np, NULL);
 }
 
 static Node *
-integeruop(char op, Node *np)
+numericaluop(char op, Node *np)
 {
- if (!np->type->integer)
- error("unary operator requires integer operand");
+ if (!np->type->arith)
+ error("unary operator requires numerical operand");
         np = promote(np);
- if (op == OCPL && np->op == OCPL)
+ if (op == ONEG && np->op == ONEG)
                 return np->left;
+ if (op == OADD)
+ return np;
         return simplify(op, np->type, np, NULL);
 }
 
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:34 CET