diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-01-18 10:01:27 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-01-18 10:05:55 +0100 |
commit | 50c928d224bff0af322f23a7d2b842cd54aa2e68 (patch) | |
tree | 4e02b167c89c2ff109f6dfd1d2734309ea0192db /include/std | |
parent | 1dbef1bfdefe8d7967a360f00d350db307d344e2 (diff) |
Start on bytecode, move object files to build directory
Diffstat (limited to 'include/std')
-rw-r--r-- | include/std/buffer.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/std/buffer.h b/include/std/buffer.h new file mode 100644 index 0000000..dea7dbd --- /dev/null +++ b/include/std/buffer.h @@ -0,0 +1,21 @@ +#ifndef TSL_BUFFER_H +#define TSL_BUFFER_H + +#include <stddef.h> + +/* + TODO: Optimize small size buffers by using data and size members (16 bytes on x86) + instead of heap allocation +*/ +typedef struct { + void *data; + size_t size; + size_t capacity; +} TslBuffer; + +void tsl_buffer_init(TslBuffer *self); +void tsl_buffer_deinit(TslBuffer *self); + +int tsl_buffer_append(TslBuffer *self, void *data, size_t size); + +#endif /* TSL_BUFFER_H */ |