From 06eff276ce3440df22674572a660e86fc21637d5 Mon Sep 17 00:00:00 2001 From: Mel Date: Mon, 4 May 2026 18:39:54 +0200 Subject: Initial lowering pass 2 implementation, create shells for source expressions and statements Signed-off-by: Mel --- boot/common.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'boot/common.c') diff --git a/boot/common.c b/boot/common.c index 3da5750..0524b3b 100644 --- a/boot/common.c +++ b/boot/common.c @@ -337,11 +337,10 @@ _slice_at(const struct _Slice* slice, uint index) #define slice_at(type, slice, index) ((type*)_slice_at(slice, index)) // a macro for iterating over each element in an array. -#define FOR_EACH_ARRAY(type, element_var, array_ptr, action) \ - for (uint i = 0; i < array_length(array_ptr); ++i) { \ - type element_var = *array_at(type, array_ptr, i); \ - action; \ - } +// for each iteration you get a pointer to the current element. +#define FOR_EACH_ARRAY(type, element_var, array_ptr) \ + for (type* element_var = (type*)(array_ptr)->data; \ + element_var < (type*)(array_ptr)->data + array_length(array_ptr); ++element_var) // the global string region. REGION(ascii, string) -- cgit 1.4.1