Skip to content
Myr

Merge branch 'stbds-arraddn' of https://github.com/HeroicKatora/stb into working

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parents 1c81674, b67dabe · Browse files · 1 file+15 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−3 removed

  • other:+15 added−3 removed

1 file+15 added−3 removed

modified:stb_ds.h+15 added-3 removed
106 unmodified lines
107 void arrins(T* a, int p, int n);108 Inserts n uninitialized items into array a starting at a[p],109 moving the rest of the array over.110111 arraddn:112 T* arraddn(T* a, int n)111 arraddnptr:112 T* arraddnptr(T* a, int n)113 Appends n uninitialized items onto array at the end.114 Returns a pointer to the first uninitialized item added.115116 arraddnoff:117 size_t arraddnoff(T* a, int n)118 Appends n uninitialized items onto array at the end.119 Returns the index of the first uninitialized item added.120121 arrdel:122 void arrdel(T* a, int p);123 Deletes the element at a[p], moving the rest of the array over.124
249 unmodified lines
374 Bugfixes:375 Andy Durdin376 Shane Liesegang377 Vinh Truong378 Andreas Molzer379*/380381#ifdef STBDS_UNIT_TESTS382#define _CRT_SECURE_NO_WARNINGS
11 unmodified lines
394#define arrput stbds_arrput395#define arrpush stbds_arrput396#define arrpop stbds_arrpop397#define arrfree stbds_arrfree398#define arraddnptr stbds_arraddnptr399#define arraddnoff stbds_arraddnoff400// deprecated401#define arraddn stbds_arraddn402#define arrsetlen stbds_arrsetlen403#define arrlast stbds_arrlast404#define arrins stbds_arrins
130 unmodified lines
535#define stbds_arrlenu(a) ((a) ? stbds_header(a)->length : 0)536#define stbds_arrput(a,v) (stbds_arrmaybegrow(a,1), (a)[stbds_header(a)->length++] = (v))537#define stbds_arrpush stbds_arrput // synonym538#define stbds_arrpop(a) (stbds_header(a)->length--, (a)[stbds_header(a)->length])539// deprecated540#define stbds_arraddn(a,n) ((void)(stbds_arraddnoff(a, n)))541#define stbds_arraddnptr(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n), &(a)[stbds_header(a)->length-(n)])530#define stbds_arraddn(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n), stbds_header(a)->length-(n))542#define stbds_arraddnoff(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n), stbds_header(a)->length-(n))543#define stbds_arrlast(a) ((a)[stbds_header(a)->length-1])544#define stbds_arrfree(a) ((void) ((a) ? STBDS_FREE(NULL,stbds_header(a)) : (void)0), (a)=NULL)545#define stbds_arrdel(a,i) stbds_arrdeln(a,i,1)546#define stbds_arrdeln(a,i,n) (memmove(&(a)[i], &(a)[(i)+(n)], sizeof *(a) * (stbds_header(a)->length-(n)-(i))), stbds_header(a)->length -= (n))
1301 unmodified lines