aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codegen.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-28 15:30:11 +0900
committernsfisis <nsfisis@gmail.com>2025-09-28 15:30:11 +0900
commit5a16856f8ff4dbf801b4a622ca7053b77e8a0214 (patch)
treea5f15bccc7b34802da8aa655d26c28848a832cff /src/codegen.c
parent1b208f7f0a3b7d6b72c2a431d9fcd6e18fe76f5d (diff)
downloadducc-5a16856f8ff4dbf801b4a622ca7053b77e8a0214.tar.gz
ducc-5a16856f8ff4dbf801b4a622ca7053b77e8a0214.tar.zst
ducc-5a16856f8ff4dbf801b4a622ca7053b77e8a0214.zip
feat: implement bitwise not operator
Diffstat (limited to 'src/codegen.c')
-rw-r--r--src/codegen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 34f6c23..f02a38c 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -87,6 +87,10 @@ static void codegen_unary_expr(CodeGen* g, AstNode* ast) {
fprintf(g->out, " sete al\n");
fprintf(g->out, " movzb rax, al\n");
fprintf(g->out, " push rax\n");
+ } else if (ast->node_op == TokenKind_tilde) {
+ fprintf(g->out, " pop rax\n");
+ fprintf(g->out, " not rax\n");
+ fprintf(g->out, " push rax\n");
} else {
unreachable();
}