aboutsummaryrefslogtreecommitdiff
path: root/alisp.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-08-20 22:33:40 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-08-20 22:33:40 +0100
commit6e2db6825d4ff4b57be3086f654a84cc9ff64bcf (patch)
treeb9a7bb71ff55f7ef6d34ab90574ed86cd1f39b43 /alisp.h
parent2369185b269164c9fd3cc888dbde117192d08bff (diff)
downloadalisp-6e2db6825d4ff4b57be3086f654a84cc9ff64bcf.tar.gz
alisp-6e2db6825d4ff4b57be3086f654a84cc9ff64bcf.tar.bz2
alisp-6e2db6825d4ff4b57be3086f654a84cc9ff64bcf.zip
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.
Diffstat (limited to 'alisp.h')
-rw-r--r--alisp.h12
1 files changed, 12 insertions, 0 deletions
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