From 01948ca06ae8f5b6d3dbbf091fe6b6d7c6905811 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Tue, 4 Oct 2016 12:57:29 -0400 Subject: Add ! to rpn --- .bin/rpn.c | 7 +++---- 1 file 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); -- cgit 1.4.1