From 641a2ed356961d5a4af643b9394bfd2a8b06dda5 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 2 Jun 2025 23:32:08 +0200 Subject: Codegen: Fix sizeof --- src/bootstrap/tokenizer.src | 3 +-- src/codegen.zig | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/tokenizer.src b/src/bootstrap/tokenizer.src index 3cbb6c1..2f57b02 100644 --- a/src/bootstrap/tokenizer.src +++ b/src/bootstrap/tokenizer.src @@ -104,8 +104,7 @@ let print_tokens = (ts: *token, ts_len: i64) => i64 { printf("Number: %d\n", *cast(*i64, to.data)); }; if (to.type == TOKEN_BOOLEAN) { - printf("Boolean: %d\n", cast(i1, to.data)); - /* TODO: FIX */ + printf("Boolean: %d\n", *cast(*bool, to.data)); }; if (to.type == TOKEN_NULL) { printf("Null\n"); diff --git a/src/codegen.zig b/src/codegen.zig index 30ef293..3fb5573 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -780,8 +780,7 @@ pub const CodeGen = struct { }, .SIZEOF_STATEMENT => |exp| { const typ = try self.get_llvm_type(exp.typ); - const size_in_bits = llvm.LLVMSizeOfTypeInBits(self.llvm_target_data, typ); - const size_in_bytes = size_in_bits / 8; + const size_in_bytes = llvm.LLVMStoreSizeOfType(self.llvm_target_data, typ); const size_val = llvm.LLVMConstInt(llvm.LLVMInt64Type(), size_in_bytes, 0); -- cgit 1.4.1