2018-05-05 19:38:55 +00:00
|
|
|
#ifndef ALIGNED_VECTOR_H
|
|
|
|
#define ALIGNED_VECTOR_H
|
|
|
|
|
2018-05-28 07:52:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-05-05 19:38:55 +00:00
|
|
|
typedef struct {
|
|
|
|
unsigned int size;
|
|
|
|
unsigned int capacity;
|
|
|
|
unsigned char* data;
|
|
|
|
unsigned int element_size;
|
|
|
|
} AlignedVector;
|
|
|
|
|
2018-05-28 06:16:50 +00:00
|
|
|
#define ALIGNED_VECTOR_INITIAL_CAPACITY 256u
|
|
|
|
|
2018-05-26 18:17:42 +00:00
|
|
|
void aligned_vector_init(AlignedVector* vector, unsigned int element_size);
|
|
|
|
void aligned_vector_reserve(AlignedVector* vector, unsigned int element_count);
|
|
|
|
void aligned_vector_push_back(AlignedVector* vector, const void* objs, unsigned int count);
|
2018-08-16 16:51:15 +00:00
|
|
|
void* aligned_vector_resize(AlignedVector* vector, const unsigned int element_count);
|
2018-07-09 07:57:01 +00:00
|
|
|
void* aligned_vector_at(const AlignedVector* vector, const unsigned int index);
|
2018-05-26 18:17:42 +00:00
|
|
|
void* aligned_vector_extend(AlignedVector* vector, const unsigned int additional_count);
|
|
|
|
void aligned_vector_clear(AlignedVector* vector);
|
|
|
|
void aligned_vector_shrink_to_fit(AlignedVector* vector);
|
|
|
|
void aligned_vector_cleanup(AlignedVector* vector);
|
2018-07-10 19:27:15 +00:00
|
|
|
void* aligned_vector_back(AlignedVector* vector);
|
2018-05-05 19:38:55 +00:00
|
|
|
|
2018-05-28 07:52:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-05-05 19:38:55 +00:00
|
|
|
#endif // ALIGNED_VECTOR_H
|