diff options
| author | Mel <mel@rnrd.eu> | 2026-05-04 18:39:54 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2026-05-04 18:39:54 +0200 |
| commit | 06eff276ce3440df22674572a660e86fc21637d5 (patch) | |
| tree | 43b7821dcaf9bb9a2600ee7a684d82469069e77d /boot/common.c | |
| parent | 8a69b17ff0ce5c132391124f3c89e03338dede19 (diff) | |
| download | catskill-06eff276ce3440df22674572a660e86fc21637d5.tar.zst catskill-06eff276ce3440df22674572a660e86fc21637d5.zip | |
Initial lowering pass 2 implementation, create shells for source expressions and statements
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/common.c')
| -rw-r--r-- | boot/common.c | 9 |
1 files changed, 4 insertions, 5 deletions
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) |
