RetroArch
Classes | Macros | Functions | Variables
dynarray.h File Reference
#include <assert.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for dynarray.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dg__dynarr_md
 

Macros

#define DG__DYNARR_H
 
#define DG_DYNARR_INDEX_CHECK_LEVEL   3
 
#define DG_DYNARR_ASSERT(cond, msg)   assert((cond) && msg)
 
#define DG_DYNARR_DEF
 
#define DG_DYNARR_INLINE   static INLINE
 
#define DA_TYPEDEF(TYPE, NewArrayTypeName)   DG_DYNARR_TYPEDEF(TYPE, NewArrayTypeName)
 
#define da_init(a)   dg_dynarr_init(a)
 
#define da_init_external(a, buf, buf_cap)   dg_dynarr_init_external(a, buf, buf_cap)
 
#define da_free(a)   dg_dynarr_free(a)
 
#define da_push(a, v)   dg_dynarr_push(a, v)
 
#define da_add(a, v)   dg_dynarr_add(a, v)
 
#define da_addn(a, vals, n)   dg_dynarr_addn(a, vals, n)
 
#define da_addn_zeroed(a, n)   dg_dynarr_addn_zeroed(a, n)
 
#define da_addn_uninit(a, n)   dg_dynarr_addn_uninit(a, n)
 
#define da_insert(a, idx, v)   dg_dynarr_insert(a, idx, v)
 
#define da_insertn(a, idx, vals, n)   dg_dynarr_insertn(a, idx, vals, n)
 
#define da_insertn_zeroed(a, idx, n)   dg_dynarr_insertn_zeroed(a, idx, n)
 
#define da_insertn_uninit(a, idx, n)   dg_dynarr_insertn_uninit(a, idx, n)
 
#define da_set(a, idx, v)   dg_dynarr_set(a, idx, v)
 
#define da_setn(a, idx, vals, n)   dg_dynarr_setn(a, idx, vals, n)
 
#define da_delete(a, idx)   dg_dynarr_delete(a, idx)
 
#define da_deleten(a, idx, n)   dg_dynarr_deleten(a, idx, n)
 
#define da_deletefast(a, idx)   dg_dynarr_deletefast(a, idx)
 
#define da_deletenfast(a, idx, n)   dg_dynarr_deletenfast(a, idx, n)
 
#define da_clear(a)   dg_dynarr_clear(a)
 
#define da_setcount(a, cnt)   dg_dynarr_setcount(a, cnt)
 
#define da_reserve(a, cap)   dg_dynarr_reserve(a, cap)
 
#define da_shrink_to_fit(a)   dg_dynarr_shrink_to_fit(a)
 
#define da_pop(a)   dg_dynarr_pop(a)
 
#define da_last(a)   dg_dynarr_last(a)
 
#define da_lastptr(a)   dg_dynarr_lastptr(a)
 
#define da_get(a, idx)   dg_dynarr_get(a,idx)
 
#define da_getptr(a, idx)   dg_dynarr_getptr(a, idx)
 
#define da_begin(a)   dg_dynarr_begin(a)
 
#define da_end(a)   dg_dynarr_end(a)
 
#define da_count(a)   dg_dynarr_count(a)
 
#define da_capacity(a)   dg_dynarr_capacity(a)
 
#define da_empty(a)   dg_dynarr_empty(a)
 
#define da_oom(a)   dg_dynarr_oom(a)
 
#define da_sort(a, cmp)   dg_dynarr_sort(a, cmp)
 
#define DG_DYNARR_TYPEDEF(TYPE, NewArrayTypeName)   typedef struct { TYPE* p; dg__dynarr_md md; } NewArrayTypeName;
 
#define dg_dynarr_init(a)   dg__dynarr_init((void**)&(a).p, &(a).md, NULL, 0)
 
#define dg_dynarr_init_external(a, buf, buf_cap)   dg__dynarr_init((void**)&(a).p, &(a).md, (buf), (buf_cap))
 
#define dg_dynarr_free(a)   dg__dynarr_free((void**)&(a).p, &(a).md)
 
#define dg_dynarr_push(a, v)   (dg__dynarr_maybegrowadd(dg__dynarr_unp(a), 1) ? (((a).p[(a).md.cnt++] = (v)),0) : 0)
 
#define dg_dynarr_add(a, v)   dg_dynarr_push((a), (v))
 
#define dg_dynarr_addn(a, vals, n)
 
#define dg_dynarr_addn_zeroed(a, n)   (dg__dynarr_add(dg__dynarr_unp(a), (n), 1) ? &(a).p[(a).md.cnt-(size_t)(n)] : NULL)
 
#define dg_dynarr_addn_uninit(a, n)   (dg__dynarr_add(dg__dynarr_unp(a), (n), 0) ? &(a).p[(a).md.cnt-(size_t)(n)] : NULL)
 
#define dg_dynarr_insert(a, idx, v)
 
#define dg_dynarr_insertn(a, idx, vals, n)
 
#define dg_dynarr_insertn_zeroed(a, idx, n)
 
#define dg_dynarr_insertn_uninit(a, idx, n)
 
#define dg_dynarr_set(a, idx, v)
 
#define dg_dynarr_setn(a, idx, vals, n)
 
#define dg_dynarr_delete(a, idx)   (dg__dynarr_checkidx((a),(idx)), dg__dynarr_delete(dg__dynarr_unp(a), (idx), 1))
 
#define dg_dynarr_deleten(a, idx, n)   (dg__dynarr_checkidx((a),(idx)), dg__dynarr_delete(dg__dynarr_unp(a), (idx), (n)))
 
#define dg_dynarr_deletefast(a, idx)   (dg__dynarr_checkidx((a),(idx)), dg__dynarr_deletefast(dg__dynarr_unp(a), (idx), 1))
 
#define dg_dynarr_deletenfast(a, idx, n)   (dg__dynarr_checkidx((a),(idx)), dg__dynarr_deletefast(dg__dynarr_unp(a), idx, n))
 
#define dg_dynarr_clear(a)   ((a).md.cnt=0)
 
#define dg_dynarr_setcount(a, n)   (dg__dynarr_maybegrow(dg__dynarr_unp(a), (n)) ? ((a).md.cnt = (n)) : 0)
 
#define dg_dynarr_reserve(a, cap)   dg__dynarr_maybegrow(dg__dynarr_unp(a), (cap))
 
#define dg_dynarr_shrink_to_fit(a)   dg__dynarr_shrink_to_fit(dg__dynarr_unp(a))
 
#define dg_dynarr_pop(a)
 
#define dg_dynarr_last(a)
 
#define dg_dynarr_lastptr(a)   (((a).md.cnt > 0) ? ((a).p + (a).md.cnt - 1) : NULL)
 
#define dg_dynarr_get(a, idx)   (dg__dynarr_checkidx((a),(idx)), (a).p[dg__dynarr_idx((a).md, (idx))])
 
#define dg_dynarr_getptr(a, idx)
 
#define dg_dynarr_begin(a)   ((a).p)
 
#define dg_dynarr_end(a)   ((a).p + (a).md.cnt)
 
#define dg_dynarr_count(a)   ((a).md.cnt)
 
#define dg_dynarr_capacity(a)   ((a).md.cap & DG__DYNARR_SIZE_T_ALL_BUT_MSB)
 
#define dg_dynarr_empty(a)   ((a).md.cnt == 0)
 
#define dg_dynarr_oom(a)   ((a).md.cap == 0)
 
#define dg_dynarr_sort(a, cmp)   qsort((a).p, (a).md.cnt, sizeof((a).p[0]), (cmp))
 
#define dg__dynarr_unp(a)   (void**)&(a).p, &(a).md, sizeof((a).p[0])
 
#define DG__DYNARR_WHILE0   while(0)
 
#define dg__dynarr_checkidx(a, i)   DG_DYNARR_ASSERT((size_t)i < a.md.cnt, "index out of bounds!")
 
#define dg__dynarr_checkidxle(a, i)   DG_DYNARR_ASSERT((size_t)i <= a.md.cnt, "index out of bounds!")
 
#define dg__dynarr_check_notempty(a, msg)   DG_DYNARR_ASSERT(a.md.cnt > 0, msg)
 
#define dg__dynarr_idx(md, i)   (((size_t)(i) < md.cnt) ? (size_t)(i) : 0)
 

Functions

DG_DYNARR_DEF void dg__dynarr_free (void **p, dg__dynarr_md *md)
 
DG_DYNARR_DEF void dg__dynarr_shrink_to_fit (void **arr, dg__dynarr_md *md, size_t itemsize)
 
DG_DYNARR_DEF int dg__dynarr_grow (void **arr, dg__dynarr_md *md, size_t itemsize, size_t min_needed)
 
DG_DYNARR_INLINE void dg__dynarr_init (void **p, dg__dynarr_md *md, void *buf, size_t buf_cap)
 
DG_DYNARR_INLINE int dg__dynarr_maybegrow (void **arr, dg__dynarr_md *md, size_t itemsize, size_t min_needed)
 
DG_DYNARR_INLINE int dg__dynarr_maybegrowadd (void **arr, dg__dynarr_md *md, size_t itemsize, size_t num_add)
 
DG_DYNARR_INLINE int dg__dynarr_insert (void **arr, dg__dynarr_md *md, size_t itemsize, size_t idx, size_t n, int init0)
 
DG_DYNARR_INLINE int dg__dynarr_add (void **arr, dg__dynarr_md *md, size_t itemsize, size_t n, int init0)
 
DG_DYNARR_INLINE void dg__dynarr_delete (void **arr, dg__dynarr_md *md, size_t itemsize, size_t idx, size_t n)
 
DG_DYNARR_INLINE void dg__dynarr_deletefast (void **arr, dg__dynarr_md *md, size_t itemsize, size_t idx, size_t n)
 

Variables

static const size_t DG__DYNARR_SIZE_T_MSB = ((size_t)1) << (sizeof(size_t)*8 - 1)
 
static const size_t DG__DYNARR_SIZE_T_ALL_BUT_MSB = (((size_t)1) << (sizeof(size_t)*8 - 1))-1
 

Macro Definition Documentation

◆ da_add

#define da_add (   a,
  v 
)    dg_dynarr_add(a, v)

◆ da_addn

#define da_addn (   a,
  vals,
  n 
)    dg_dynarr_addn(a, vals, n)

◆ da_addn_uninit

#define da_addn_uninit (   a,
  n 
)    dg_dynarr_addn_uninit(a, n)

◆ da_addn_zeroed

#define da_addn_zeroed (   a,
  n 
)    dg_dynarr_addn_zeroed(a, n)

◆ da_begin

#define da_begin (   a)    dg_dynarr_begin(a)

◆ da_capacity

#define da_capacity (   a)    dg_dynarr_capacity(a)

◆ da_clear

#define da_clear (   a)    dg_dynarr_clear(a)

◆ da_count

#define da_count (   a)    dg_dynarr_count(a)

◆ da_delete

#define da_delete (   a,
  idx 
)    dg_dynarr_delete(a, idx)

◆ da_deletefast

#define da_deletefast (   a,
  idx 
)    dg_dynarr_deletefast(a, idx)

◆ da_deleten

#define da_deleten (   a,
  idx,
  n 
)    dg_dynarr_deleten(a, idx, n)

◆ da_deletenfast

#define da_deletenfast (   a,
  idx,
  n 
)    dg_dynarr_deletenfast(a, idx, n)

◆ da_empty

#define da_empty (   a)    dg_dynarr_empty(a)

◆ da_end

#define da_end (   a)    dg_dynarr_end(a)

◆ da_free

#define da_free (   a)    dg_dynarr_free(a)

◆ da_get

#define da_get (   a,
  idx 
)    dg_dynarr_get(a,idx)

◆ da_getptr

#define da_getptr (   a,
  idx 
)    dg_dynarr_getptr(a, idx)

◆ da_init

#define da_init (   a)    dg_dynarr_init(a)

◆ da_init_external

#define da_init_external (   a,
  buf,
  buf_cap 
)    dg_dynarr_init_external(a, buf, buf_cap)

◆ da_insert

#define da_insert (   a,
  idx,
  v 
)    dg_dynarr_insert(a, idx, v)

◆ da_insertn

#define da_insertn (   a,
  idx,
  vals,
  n 
)    dg_dynarr_insertn(a, idx, vals, n)

◆ da_insertn_uninit

#define da_insertn_uninit (   a,
  idx,
  n 
)    dg_dynarr_insertn_uninit(a, idx, n)

◆ da_insertn_zeroed

#define da_insertn_zeroed (   a,
  idx,
  n 
)    dg_dynarr_insertn_zeroed(a, idx, n)

◆ da_last

#define da_last (   a)    dg_dynarr_last(a)

◆ da_lastptr

#define da_lastptr (   a)    dg_dynarr_lastptr(a)

◆ da_oom

#define da_oom (   a)    dg_dynarr_oom(a)

◆ da_pop

#define da_pop (   a)    dg_dynarr_pop(a)

◆ da_push

#define da_push (   a,
  v 
)    dg_dynarr_push(a, v)

◆ da_reserve

#define da_reserve (   a,
  cap 
)    dg_dynarr_reserve(a, cap)

◆ da_set

#define da_set (   a,
  idx,
  v 
)    dg_dynarr_set(a, idx, v)

◆ da_setcount

#define da_setcount (   a,
  cnt 
)    dg_dynarr_setcount(a, cnt)

◆ da_setn

#define da_setn (   a,
  idx,
  vals,
  n 
)    dg_dynarr_setn(a, idx, vals, n)

◆ da_shrink_to_fit

#define da_shrink_to_fit (   a)    dg_dynarr_shrink_to_fit(a)

◆ da_sort

#define da_sort (   a,
  cmp 
)    dg_dynarr_sort(a, cmp)

◆ DA_TYPEDEF

#define DA_TYPEDEF (   TYPE,
  NewArrayTypeName 
)    DG_DYNARR_TYPEDEF(TYPE, NewArrayTypeName)

◆ dg__dynarr_check_notempty

#define dg__dynarr_check_notempty (   a,
  msg 
)    DG_DYNARR_ASSERT(a.md.cnt > 0, msg)

◆ dg__dynarr_checkidx

#define dg__dynarr_checkidx (   a,
 
)    DG_DYNARR_ASSERT((size_t)i < a.md.cnt, "index out of bounds!")

◆ dg__dynarr_checkidxle

#define dg__dynarr_checkidxle (   a,
 
)    DG_DYNARR_ASSERT((size_t)i <= a.md.cnt, "index out of bounds!")

◆ DG__DYNARR_H

#define DG__DYNARR_H

◆ dg__dynarr_idx

#define dg__dynarr_idx (   md,
 
)    (((size_t)(i) < md.cnt) ? (size_t)(i) : 0)

◆ dg__dynarr_unp

#define dg__dynarr_unp (   a)    (void**)&(a).p, &(a).md, sizeof((a).p[0])

◆ DG__DYNARR_WHILE0

#define DG__DYNARR_WHILE0   while(0)

◆ dg_dynarr_add

#define dg_dynarr_add (   a,
  v 
)    dg_dynarr_push((a), (v))

◆ dg_dynarr_addn

#define dg_dynarr_addn (   a,
  vals,
  n 
)
Value:
do { \
DG_DYNARR_ASSERT((vals)!=NULL, "Don't pass NULL als vals to dg_dynarr_addn!"); \
if((vals)!=NULL && dg__dynarr_add(dg__dynarr_unp(a), n, 0)) { \
size_t i_=(a).md.cnt-(n), v_=0; \
while(i_<(a).md.cnt) (a).p[i_++]=(vals)[v_++]; \
DG_DYNARR_INLINE int dg__dynarr_add(void **arr, dg__dynarr_md *md, size_t itemsize, size_t n, int init0)
Definition: dynarray.h:833
#define md
Definition: compat-1.3.h:1980
#define dg__dynarr_unp(a)
Definition: dynarray.h:694
#define NULL
Pointer to 0.
Definition: gctypes.h:65
GLfloat GLfloat p
Definition: glext.h:9809
#define DG__DYNARR_WHILE0
Definition: dynarray.h:718
GLdouble n
Definition: glext.h:8396
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_addn_uninit

#define dg_dynarr_addn_uninit (   a,
  n 
)    (dg__dynarr_add(dg__dynarr_unp(a), (n), 0) ? &(a).p[(a).md.cnt-(size_t)(n)] : NULL)

◆ dg_dynarr_addn_zeroed

#define dg_dynarr_addn_zeroed (   a,
  n 
)    (dg__dynarr_add(dg__dynarr_unp(a), (n), 1) ? &(a).p[(a).md.cnt-(size_t)(n)] : NULL)

◆ DG_DYNARR_ASSERT

#define DG_DYNARR_ASSERT (   cond,
  msg 
)    assert((cond) && msg)

◆ dg_dynarr_begin

#define dg_dynarr_begin (   a)    ((a).p)

◆ dg_dynarr_capacity

#define dg_dynarr_capacity (   a)    ((a).md.cap & DG__DYNARR_SIZE_T_ALL_BUT_MSB)

◆ dg_dynarr_clear

#define dg_dynarr_clear (   a)    ((a).md.cnt=0)

◆ dg_dynarr_count

#define dg_dynarr_count (   a)    ((a).md.cnt)

◆ DG_DYNARR_DEF

#define DG_DYNARR_DEF

◆ dg_dynarr_delete

#define dg_dynarr_delete (   a,
  idx 
)    (dg__dynarr_checkidx((a),(idx)), dg__dynarr_delete(dg__dynarr_unp(a), (idx), 1))

◆ dg_dynarr_deletefast

#define dg_dynarr_deletefast (   a,
  idx 
)    (dg__dynarr_checkidx((a),(idx)), dg__dynarr_deletefast(dg__dynarr_unp(a), (idx), 1))

◆ dg_dynarr_deleten

#define dg_dynarr_deleten (   a,
  idx,
  n 
)    (dg__dynarr_checkidx((a),(idx)), dg__dynarr_delete(dg__dynarr_unp(a), (idx), (n)))

◆ dg_dynarr_deletenfast

#define dg_dynarr_deletenfast (   a,
  idx,
  n 
)    (dg__dynarr_checkidx((a),(idx)), dg__dynarr_deletefast(dg__dynarr_unp(a), idx, n))

◆ dg_dynarr_empty

#define dg_dynarr_empty (   a)    ((a).md.cnt == 0)

◆ dg_dynarr_end

#define dg_dynarr_end (   a)    ((a).p + (a).md.cnt)

◆ dg_dynarr_free

#define dg_dynarr_free (   a)    dg__dynarr_free((void**)&(a).p, &(a).md)

◆ dg_dynarr_get

#define dg_dynarr_get (   a,
  idx 
)    (dg__dynarr_checkidx((a),(idx)), (a).p[dg__dynarr_idx((a).md, (idx))])

◆ dg_dynarr_getptr

#define dg_dynarr_getptr (   a,
  idx 
)
Value:
((size_t)(idx) < (a).md.cnt) ? ((a).p+(size_t)(idx)) : NULL)
#define md
Definition: compat-1.3.h:1980
#define NULL
Pointer to 0.
Definition: gctypes.h:65
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
#define dg__dynarr_checkidx(a, i)
Definition: dynarray.h:724
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ DG_DYNARR_INDEX_CHECK_LEVEL

#define DG_DYNARR_INDEX_CHECK_LEVEL   3

◆ dg_dynarr_init

#define dg_dynarr_init (   a)    dg__dynarr_init((void**)&(a).p, &(a).md, NULL, 0)

◆ dg_dynarr_init_external

#define dg_dynarr_init_external (   a,
  buf,
  buf_cap 
)    dg__dynarr_init((void**)&(a).p, &(a).md, (buf), (buf_cap))

◆ DG_DYNARR_INLINE

#define DG_DYNARR_INLINE   static INLINE

◆ dg_dynarr_insert

#define dg_dynarr_insert (   a,
  idx,
  v 
)
Value:
dg__dynarr_insert(dg__dynarr_unp(a), (idx), 1, 0), \
(a).p[dg__dynarr_idx((a).md, (idx))] = (v))
#define dg__dynarr_idx(md, i)
Definition: dynarray.h:749
#define dg__dynarr_unp(a)
Definition: dynarray.h:694
#define dg__dynarr_checkidxle(a, i)
Definition: dynarray.h:728
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
const GLdouble * v
Definition: glext.h:6391
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_insertn

#define dg_dynarr_insertn (   a,
  idx,
  vals,
  n 
)
Value:
do { \
DG_DYNARR_ASSERT((vals)!=NULL, "Don't pass NULL as vals to dg_dynarr_insertn!"); \
dg__dynarr_checkidxle((a),(idx)); \
if((vals)!=NULL && dg__dynarr_insert(dg__dynarr_unp(a), (idx), (n), 0)){ \
size_t i_=(idx), v_=0, e_=(idx)+(n); \
while(i_ < e_) (a).p[i_++] = (vals)[v_++]; \
DG_DYNARR_INLINE int dg__dynarr_insert(void **arr, dg__dynarr_md *md, size_t itemsize, size_t idx, size_t n, int init0)
Definition: dynarray.h:812
#define dg__dynarr_unp(a)
Definition: dynarray.h:694
#define NULL
Pointer to 0.
Definition: gctypes.h:65
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
#define DG__DYNARR_WHILE0
Definition: dynarray.h:718
GLdouble n
Definition: glext.h:8396
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_insertn_uninit

#define dg_dynarr_insertn_uninit (   a,
  idx,
  n 
)
Value:
dg__dynarr_insert(dg__dynarr_unp(a), idx, n, 0) \
? &(a).p[dg__dynarr_idx((a).md, (idx))] : NULL)
#define dg__dynarr_idx(md, i)
Definition: dynarray.h:749
#define dg__dynarr_unp(a)
Definition: dynarray.h:694
#define NULL
Pointer to 0.
Definition: gctypes.h:65
#define dg__dynarr_checkidxle(a, i)
Definition: dynarray.h:728
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
GLdouble n
Definition: glext.h:8396
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_insertn_zeroed

#define dg_dynarr_insertn_zeroed (   a,
  idx,
  n 
)
Value:
dg__dynarr_insert(dg__dynarr_unp(a), (idx), (n), 1) \
? &(a).p[dg__dynarr_idx((a).md, (idx))] : NULL)
#define dg__dynarr_idx(md, i)
Definition: dynarray.h:749
#define dg__dynarr_unp(a)
Definition: dynarray.h:694
#define NULL
Pointer to 0.
Definition: gctypes.h:65
#define dg__dynarr_checkidxle(a, i)
Definition: dynarray.h:728
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
GLdouble n
Definition: glext.h:8396
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_last

#define dg_dynarr_last (   a)
Value:
(dg__dynarr_check_notempty((a), "Don't call da_last() on an empty array!"), \
(a).p[((a).md.cnt > 0) ? ((a).md.cnt-1) : 0])
#define dg__dynarr_check_notempty(a, msg)
Definition: dynarray.h:731
GLfloat GLfloat p
Definition: glext.h:9809
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_lastptr

#define dg_dynarr_lastptr (   a)    (((a).md.cnt > 0) ? ((a).p + (a).md.cnt - 1) : NULL)

◆ dg_dynarr_oom

#define dg_dynarr_oom (   a)    ((a).md.cap == 0)

◆ dg_dynarr_pop

#define dg_dynarr_pop (   a)
Value:
(dg__dynarr_check_notempty((a), "Don't pop an empty array!"), \
(a).p[((a).md.cnt > 0) ? (--(a).md.cnt) : 0])
#define dg__dynarr_check_notempty(a, msg)
Definition: dynarray.h:731
GLfloat GLfloat p
Definition: glext.h:9809
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_push

#define dg_dynarr_push (   a,
  v 
)    (dg__dynarr_maybegrowadd(dg__dynarr_unp(a), 1) ? (((a).p[(a).md.cnt++] = (v)),0) : 0)

◆ dg_dynarr_reserve

#define dg_dynarr_reserve (   a,
  cap 
)    dg__dynarr_maybegrow(dg__dynarr_unp(a), (cap))

◆ dg_dynarr_set

#define dg_dynarr_set (   a,
  idx,
  v 
)
Value:
(a).p[dg__dynarr_idx((a).md, (idx))] = (v))
#define dg__dynarr_idx(md, i)
Definition: dynarray.h:749
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
const GLdouble * v
Definition: glext.h:6391
#define dg__dynarr_checkidx(a, i)
Definition: dynarray.h:724
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_setcount

#define dg_dynarr_setcount (   a,
  n 
)    (dg__dynarr_maybegrow(dg__dynarr_unp(a), (n)) ? ((a).md.cnt = (n)) : 0)

◆ dg_dynarr_setn

#define dg_dynarr_setn (   a,
  idx,
  vals,
  n 
)
Value:
do { \
DG_DYNARR_ASSERT((vals)!=NULL, "Don't pass NULL as vals to dg_dynarr_setn!"); \
size_t idx_=(idx); size_t end_=idx_+(size_t)n; \
dg__dynarr_checkidx((a),idx_); dg__dynarr_checkidx((a),end_-1); \
if((vals)!=NULL && idx_ < (a).md.cnt && end_ <= (a).md.cnt) { \
size_t v_=0; \
while(idx_ < end_) (a).p[idx_++] = (vals)[v_++]; \
#define md
Definition: compat-1.3.h:1980
#define NULL
Pointer to 0.
Definition: gctypes.h:65
GLfloat GLfloat p
Definition: glext.h:9809
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
#define DG__DYNARR_WHILE0
Definition: dynarray.h:718
#define dg__dynarr_checkidx(a, i)
Definition: dynarray.h:724
GLdouble n
Definition: glext.h:8396
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ dg_dynarr_shrink_to_fit

#define dg_dynarr_shrink_to_fit (   a)    dg__dynarr_shrink_to_fit(dg__dynarr_unp(a))

◆ dg_dynarr_sort

#define dg_dynarr_sort (   a,
  cmp 
)    qsort((a).p, (a).md.cnt, sizeof((a).p[0]), (cmp))

◆ DG_DYNARR_TYPEDEF

#define DG_DYNARR_TYPEDEF (   TYPE,
  NewArrayTypeName 
)    typedef struct { TYPE* p; dg__dynarr_md md; } NewArrayTypeName;

Function Documentation

◆ dg__dynarr_add()

DG_DYNARR_INLINE int dg__dynarr_add ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  n,
int  init0 
)
Here is the call graph for this function:

◆ dg__dynarr_delete()

DG_DYNARR_INLINE void dg__dynarr_delete ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  idx,
size_t  n 
)

◆ dg__dynarr_deletefast()

DG_DYNARR_INLINE void dg__dynarr_deletefast ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  idx,
size_t  n 
)
Here is the call graph for this function:

◆ dg__dynarr_free()

DG_DYNARR_DEF void dg__dynarr_free ( void **  p,
dg__dynarr_md md 
)

◆ dg__dynarr_grow()

DG_DYNARR_DEF int dg__dynarr_grow ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  min_needed 
)
Here is the caller graph for this function:

◆ dg__dynarr_init()

DG_DYNARR_INLINE void dg__dynarr_init ( void **  p,
dg__dynarr_md md,
void buf,
size_t  buf_cap 
)

◆ dg__dynarr_insert()

DG_DYNARR_INLINE int dg__dynarr_insert ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  idx,
size_t  n,
int  init0 
)
Here is the call graph for this function:

◆ dg__dynarr_maybegrow()

DG_DYNARR_INLINE int dg__dynarr_maybegrow ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  min_needed 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dg__dynarr_maybegrowadd()

DG_DYNARR_INLINE int dg__dynarr_maybegrowadd ( void **  arr,
dg__dynarr_md md,
size_t  itemsize,
size_t  num_add 
)
Here is the call graph for this function:

◆ dg__dynarr_shrink_to_fit()

DG_DYNARR_DEF void dg__dynarr_shrink_to_fit ( void **  arr,
dg__dynarr_md md,
size_t  itemsize 
)

Variable Documentation

◆ DG__DYNARR_SIZE_T_ALL_BUT_MSB

const size_t DG__DYNARR_SIZE_T_ALL_BUT_MSB = (((size_t)1) << (sizeof(size_t)*8 - 1))-1
static

◆ DG__DYNARR_SIZE_T_MSB

const size_t DG__DYNARR_SIZE_T_MSB = ((size_t)1) << (sizeof(size_t)*8 - 1)
static