summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2016-10-04 12:57:29 -0400
committerJune McEnroe <june@causal.agency>2016-10-04 12:57:29 -0400
commit7eaa9cd8e36c89c1d685d317c9d54375915f42e6 (patch)
treefb2e02efbbcb9dddd3621b1dd07b3541c35a2c9f
parentAdd quoting to rpn (diff)
downloadsrc-7eaa9cd8e36c89c1d685d317c9d54375915f42e6.tar.gz
src-7eaa9cd8e36c89c1d685d317c9d54375915f42e6.zip
Add ! to rpn
Diffstat (limited to '')
-rwxr-xr-x.bin/rpn.c7
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);