mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Refactoring access + some macro renaming.
This commit is contained in:
@@ -255,8 +255,8 @@ typedef struct
|
||||
|
||||
static inline VHeader_* vec_new_(size_t element_size, size_t capacity)
|
||||
{
|
||||
ASSERT0(capacity < UINT32_MAX);
|
||||
ASSERT0(element_size < UINT32_MAX / 100);
|
||||
ASSERT(capacity < UINT32_MAX);
|
||||
ASSERT(element_size < UINT32_MAX / 100);
|
||||
VHeader_ *header = CALLOC(element_size * capacity + sizeof(VHeader_));
|
||||
header->capacity = (uint32_t)capacity;
|
||||
return header;
|
||||
@@ -273,8 +273,8 @@ static inline void vec_resize(void *vec, uint32_t new_size)
|
||||
|
||||
static inline void vec_pop(void *vec)
|
||||
{
|
||||
ASSERT0(vec);
|
||||
ASSERT0(vec_size(vec) > 0);
|
||||
ASSERT(vec);
|
||||
ASSERT(vec_size(vec) > 0);
|
||||
VHeader_ *header = vec;
|
||||
header[-1].size--;
|
||||
}
|
||||
@@ -282,9 +282,9 @@ static inline void vec_pop(void *vec)
|
||||
static inline void vec_erase_front(void *vec, unsigned to_erase)
|
||||
{
|
||||
if (!to_erase) return;
|
||||
ASSERT0(vec);
|
||||
ASSERT(vec);
|
||||
unsigned size = vec_size(vec);
|
||||
ASSERT0(size >= to_erase);
|
||||
ASSERT(size >= to_erase);
|
||||
void **vecptr = (void**)vec;
|
||||
for (int i = to_erase; i < size; i++)
|
||||
{
|
||||
@@ -296,9 +296,9 @@ static inline void vec_erase_front(void *vec, unsigned to_erase)
|
||||
|
||||
static inline void vec_erase_at(void *vec, unsigned i)
|
||||
{
|
||||
ASSERT0(vec);
|
||||
ASSERT(vec);
|
||||
unsigned size = vec_size(vec);
|
||||
ASSERT0(size > i);
|
||||
ASSERT(size > i);
|
||||
void **vecptr = (void**)vec;
|
||||
for (int j = i + 1; j < size; j++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user