From ca6f2ec64941953f0111a64b7acf4cf6fb31929a Mon Sep 17 00:00:00 2001 From: A404M Date: Sat, 31 May 2025 15:09:23 +0330 Subject: add array access support to arrays --- code/lib/io.felan | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'code/lib/io.felan') diff --git a/code/lib/io.felan b/code/lib/io.felan index 3019092..ff697e2 100644 --- a/code/lib/io.felan +++ b/code/lib/io.felan @@ -6,10 +6,10 @@ puts :: @c_function(libc,"puts",(*u8)->i32); putchar :: @c_function(libc,"putchar",(i32)->void); print :: (value:string) -> void { - i :u64= 0; - while i < value.length { + i := 0; + while i < @cast(value.length,i64) { print_char(value[i]); - i += @cast(1,u64); + i += 1; } }; @@ -59,7 +59,7 @@ _print_signed :: (comptime t:type, value:t) -> i32 { _print_unsigned :: (comptime t:type, value:t) -> void { NUMBERS_SIZE :: 21; - numbers : [NUMBERS_SIZE]u8 = undefined; + numbers := @stack_alloc(NUMBERS_SIZE,u8); i := NUMBERS_SIZE - 1; numbers[i] = '\0'; -- cgit v1.2.3