From dfb6adbcbcc7d50b770b6d5ea82efdd8f8c32e25 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 5 Oct 2024 12:48:05 +1000 Subject: delete documentation workflow --- archive/src/std/containers/stack_array.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 archive/src/std/containers/stack_array.h (limited to 'archive/src/std/containers/stack_array.h') diff --git a/archive/src/std/containers/stack_array.h b/archive/src/std/containers/stack_array.h new file mode 100644 index 0000000..d2b6bdd --- /dev/null +++ b/archive/src/std/containers/stack_array.h @@ -0,0 +1,19 @@ +#pragma once +#include + +// Defines "_sarray" types + +#define TYPED_STACK_ARRAY(T, Name, Len) \ + typedef struct Name##_sarray { \ + T items[ Len ]; \ + size_t len; \ + } Name##_sarray; \ + Name##_sarray Name##_sarray_create() { \ + Name##_sarray arr = { .len = 0 }; \ + return arr; \ + } \ + bool Name##_sarray_push(Name##_sarray* arr, T item) { \ + if (arr->len == Len) { return false; }\ + arr->items[arr->len++] = item;\ + return true;\ + } -- cgit v1.2.3-70-g09d2