gwion-util
utilities for the Gwion project
Loading...
Searching...
No Matches
src
mp_vector.c
Go to the documentation of this file.
1
#include "
gwion_util.h
"
2
#undef new_mp_vector
3
ANN
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
}
ANN
#define ANN
Definition
defs.h:19
m_uint
uintptr_t m_uint
Definition
gwcommon.h:11
gwion_util.h
meta header (use this to include the whole library)
new_mp_vector
#define new_mp_vector(mp, type, data)
Definition
mp_vector.h:26
mp_malloc2
#define mp_malloc2(p, sz)
Definition
mpool.h:30
MP_Vector
Definition
mp_vector.h:4
MP_Vector::cap
uint32_t cap
Definition
mp_vector.h:6
MP_Vector::len
uint32_t len
Definition
mp_vector.h:5
MemPool_
Definition
mpool.h:8
Generated by
1.10.0