diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-06 13:49:29 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-06 13:49:29 +0100 |
| commit | 4d25ba6d432517141498795196c9705ab0b2bc8f (patch) | |
| tree | 7737308a25a2f42e081e955c2a4bac39a28e67a8 /lib/container/container.h | |
| parent | 0a57668e4a71b5e1703a150c59b53c9904d8dfaa (diff) | |
add general purpose container
Diffstat (limited to 'lib/container/container.h')
| -rw-r--r-- | lib/container/container.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/container/container.h b/lib/container/container.h new file mode 100644 index 0000000..a7e6690 --- /dev/null +++ b/lib/container/container.h @@ -0,0 +1,25 @@ +#ifndef CONTAINER_H +#define CONTAINER_H + +#include "../sys/sizes.h" + +typedef struct { + void *data; + u64 size; + u64 element_size; + u64 data_size; +} container_t; + + +container_t *new_container(u64 element_size); +void free_container(container_t *); +void container_push(container_t *, u64 value); +void container_erase(container_t *, u64 start, u64 end); +void container_resize(container_t *, u64 new_size); +u64 container_get(container_t *, u64 index); +void container_set(container_t *, u64 index, u64 data); +void container_merge(container_t *, container_t *); +void container_append(container_t *, void *, u64 size); + + +#endif |