scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 3f1579403feed901243196776461d5f02035fac7
parent 3394d4da4e02f25e0ffbafca52f7a41c49fd6ef0
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 11 Apr 2014 18:57:45 +0200

Simplify bit logical functions

All these functions were using a comparasion and letter a
call to next, and basically this is the same than accept, so
it is changed.

Diffstat:
Mexpr.c | 12+++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/expr.c b/expr.c @@ -417,10 +417,8 @@ bit_and(void) register Node *np; np = eq(); - while (yytoken == '&') { - next(); + while (accept('&')) np = bitlogic(OBAND, np, eq()); - } return np; } @@ -430,10 +428,8 @@ bit_xor(void) register Node *np; np = bit_and(); - while (yytoken == '^') { - next(); + while (accept('^')) np = bitlogic(OBXOR, np, bit_and()); - } return np; } @@ -443,10 +439,8 @@ bit_or(void) register Node *np; np = bit_xor(); - while (yytoken == '|') { - next(); + while (accept('|')) np = bitlogic(OBOR, np, bit_xor()); - } return np; }