aboutsummaryrefslogtreecommitdiff
path: root/vec.h
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-07-21 16:53:37 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-07-21 16:53:37 +0200
commit85b0db24804e6a8a66f557ac8917596db5fc5d9f (patch)
tree22cdfbf325fe7ecadc744a668f28c46b03e0f008 /vec.h
parent2d225abf3b482fa2bf8cf9a56b8caefcc5724447 (diff)
refactor: Better types
Diffstat (limited to 'vec.h')
-rw-r--r--vec.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/vec.h b/vec.h
index f7e5295..d43fafb 100644
--- a/vec.h
+++ b/vec.h
@@ -2,18 +2,19 @@
#include <stdint.h>
#include "memory.h"
+#include "types.h"
#ifndef VEC_H
#define VEC_H
typedef struct {
void *data;
- ptrdiff_t len;
- ptrdiff_t cap;
- uintptr_t size;
+ size len;
+ size cap;
+ size size;
int align;
} Vec;
#define Vec_new(a, T, cap) _Vec_new(a, sizeof(T), cap, _Alignof(T))
-Vec _Vec_new(Arena *a, int size, ptrdiff_t cap, int align);
+Vec _Vec_new(Arena *a, size tsize, size cap, int align);
void Vec_push(Arena *a, Vec *v, void *data);
#define Vec_get(v, T, p) (T *)_Vec_get(v, p)
void *_Vec_get(Vec *v, int pos);