gwion-util
utilities for the Gwion project
Loading...
Searching...
No Matches
mp_vector.c
Go to the documentation of this file.
1#include "gwion_util.h"
2#undef new_mp_vector
3ANN MP_Vector *new_mp_vector(const MemPool mp, const uint32_t size, const uint32_t len) {
4 m_uint cap = 1;
5 while (cap < len) cap *= 2;
6 const size_t sz = cap * size;
7 MP_Vector *a = (MP_Vector *)mp_malloc2(mp, sizeof(MP_Vector) + sz);
8 a->cap = cap;
9 a->len = len;
10 return a;
11}
#define ANN
Definition defs.h:19
uintptr_t m_uint
Definition gwcommon.h:11
meta header (use this to include the whole library)
#define new_mp_vector(mp, type, data)
Definition mp_vector.h:26
#define mp_malloc2(p, sz)
Definition mpool.h:30
uint32_t cap
Definition mp_vector.h:6
uint32_t len
Definition mp_vector.h:5