gwion-util
utilities for the Gwion project
Loading...
Searching...
No Matches
Functions
mp_vector.c File Reference
#include "gwion_util.h"

Go to the source code of this file.

Functions

ANN MP_Vectornew_mp_vector (const MemPool mp, const uint32_t size, const uint32_t len)
 

Function Documentation

◆ new_mp_vector()

ANN MP_Vector * new_mp_vector ( const MemPool mp,
const uint32_t size,
const uint32_t len )

Definition at line 3 of file mp_vector.c.

3 {
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}
uintptr_t m_uint
Definition gwcommon.h:11
#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