diff options
author | June McEnroe <june@causal.agency> | 2016-10-04 12:57:29 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2016-10-04 12:57:29 -0400 |
commit | 7eaa9cd8e36c89c1d685d317c9d54375915f42e6 (patch) | |
tree | fb2e02efbbcb9dddd3621b1dd07b3541c35a2c9f | |
parent | Add quoting to rpn (diff) | |
download | src-7eaa9cd8e36c89c1d685d317c9d54375915f42e6.tar.gz src-7eaa9cd8e36c89c1d685d317c9d54375915f42e6.zip |
Add ! to rpn
Diffstat (limited to '')
-rwxr-xr-x | .bin/rpn.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/.bin/rpn.c b/.bin/rpn.c index d3fe0667..b7d3e0a1 100755 --- a/.bin/rpn.c +++ b/.bin/rpn.c @@ -55,10 +55,8 @@ static bool stack_op(char op) { return true; } if (stack.op == '"') { - if (op == '"') - stack.op = 0; - else - push(op); + if (op == '"') stack.op = 0; + else push(op); return true; } @@ -73,6 +71,7 @@ static bool stack_op(char op) { break; case '*': a = pop(); push(pop() * a); break; case '/': a = pop(); push(pop() / a); break; case '%': a = pop(); push(pop() % a); + break; case '!': a = pop(); push(!a); break; case '~': a = pop(); push(~a); break; case '&': a = pop(); push(pop() & a); break; case '|': a = pop(); push(pop() | a); |