From 6e2db6825d4ff4b57be3086f654a84cc9ff64bcf Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 20 Aug 2025 22:33:40 +0100 Subject: Stable vector implementation Stable vectors will be used in the lisp runtime to implement actual vectors, instead of using the disgusting lvec trick. This way we at least can get attributes about the vector through one pointer hop. --- alisp.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'alisp.h') diff --git a/alisp.h b/alisp.h index cf9ef55..fe24c74 100644 --- a/alisp.h +++ b/alisp.h @@ -46,6 +46,18 @@ typedef struct sv_t sv_copy(sv_t); +/// Good ol' Dynamic Arrays +typedef struct Vector +{ + u64 size, capacity; + void *data; +} vec_t; + +#define VEC_MULT 2 +void vec_free(vec_t *); +void vec_ensure_free(vec_t *, u64); +void vec_append(vec_t *, void *, u64); +void vec_clone(vec_t *, vec_t *); /// Inlined Dynamic arrays typedef struct InlineVector -- cgit v1.2.3-13-gbd6f