Make conses a vector, add VEC_SIZE macro

Easier to iterate through, O(1) amortized registering just like the
Linked List.

VEC_SIZE just makes it easier to iterate through a vector of specially
typed elements.
This commit is contained in:
2026-01-21 09:44:18 +00:00
parent 2ec1dfa083
commit 8c190e955d
2 changed files with 14 additions and 19 deletions

View File

@@ -76,7 +76,8 @@ typedef struct Vector
static_assert(sizeof(vec_t) == 64, "vec_t has to be 64 bytes as part of SBO");
#define VEC_GET(V, T) ((T *)vec_data(V))
#define VEC_GET(V, T) ((T *)vec_data(V))
#define VEC_SIZE(V, T) ((V)->size / (sizeof(T)))
void vec_init(vec_t *, u64);
void vec_free(vec_t *);
@@ -183,7 +184,7 @@ typedef struct
/// System context
typedef struct
{
lisp_t *conses;
vec_t conses;
sym_table_t symtable;
} sys_t;