summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <curtis.mcenroe@adgear.com>2016-10-04 12:57:29 -0400
committerJune McEnroe <curtis.mcenroe@adgear.com>2016-10-04 12:57:29 -0400
commit01948ca06ae8f5b6d3dbbf091fe6b6d7c6905811 (patch)
treeeecacdc81220ca345539e11e8f6aa35244f24be3
parentAdd quoting to rpn (diff)
downloadsrc-01948ca06ae8f5b6d3dbbf091fe6b6d7c6905811.tar.gz
src-01948ca06ae8f5b6d3dbbf091fe6b6d7c6905811.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);