From 203928aa81efcb4a2dda743f4a551b54eb4b236a Mon Sep 17 00:00:00 2001 From: Gregory Wells Date: Sun, 3 Aug 2025 15:07:51 -0400 Subject: [PATCH] some more array list functions --- utils/lists/gryphn_array_list.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/lists/gryphn_array_list.h b/utils/lists/gryphn_array_list.h index 9a2da15..30267dc 100644 --- a/utils/lists/gryphn_array_list.h +++ b/utils/lists/gryphn_array_list.h @@ -11,7 +11,8 @@ void type##ArrayListResize(type##ArrayList list, int count); \ void type##ArrayListRemove(type##ArrayList list); \ void type##ArrayListPopHead(type##ArrayList list); \ uint32_t type##ArrayListCount(type##ArrayList list); \ -type type##ArrayAt(type##ArrayList list, int i); +type type##ArrayListAt(type##ArrayList list, int i); \ +type* type##ArrayListData(type##ArrayList list) #define GN_ARRAY_LIST_DEFINITION(type)\ typedef struct type##ArrayList_t { \ @@ -63,13 +64,16 @@ list->data[i] = list->data[i + 1];\ uint32_t type##ArrayListCount(type##ArrayList list) { \ return list->count; \ } \ -type type##ArrayAt(type##ArrayList list, int i) { \ +type type##ArrayListAt(type##ArrayList list, int i) { \ return list->data[i]; \ +} \ +type* type##ArrayListData(type##ArrayList list) { \ + return &list->data[0]; \ } -GN_ARRAY_LIST_HEADER(uint32_t) +GN_ARRAY_LIST_HEADER(uint32_t); GN_ARRAY_LIST_DEFINITION(uint32_t) -GN_ARRAY_LIST_HEADER(int) +GN_ARRAY_LIST_HEADER(int); GN_ARRAY_LIST_DEFINITION(int)