mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-24 04:41:25 +00:00
Fixing vector macros
This commit is contained in:
parent
890ca3c782
commit
46c2fe2443
1 changed files with 4 additions and 4 deletions
8
gmqcc.h
8
gmqcc.h
|
@ -295,16 +295,16 @@ void _util_vec_grow(void **a, size_t i, size_t s);
|
|||
/* exposed interface */
|
||||
#define vec_meta(A) (((vector_t*)(A)) - 1)
|
||||
#define vec_free(A) ((A) ? (mem_d((void*)vec_meta(A)), (A) = NULL) : 0)
|
||||
#define vec_push(A,V) (GMQCC_VEC_WILLGROW(A,1), (A)[vec_meta(A)->used++] = V)
|
||||
#define vec_push(A,V) (GMQCC_VEC_WILLGROW(A,1), (A)[vec_meta(A)->used++] = (V))
|
||||
#define vec_size(A) ((A) ? vec_meta(A)->used : 0)
|
||||
#define vec_add(A,N) (GMQCC_VEC_WILLGROW(A,N), vec_meta(A)->used += (N), &(A)[vec_meta(A)->used-(N)])
|
||||
#define vec_last(A) ((A)[vec_meta(A)->used - 1])
|
||||
#define vec_pop(A) (vec_meta(A)->used -= 1)
|
||||
#define vec_shrinkto(A,N) (vec_meta(A)->used = (N))
|
||||
#define vec_shrinkby(A,N) (vec_meta(A)->used -= (N))
|
||||
#define vec_append(A,N,S) memcpy(vec_add(A, N), S, N * sizeof(*S))
|
||||
#define vec_upload(X,Y,S) memcpy(vec_add(X, S * sizeof(*Y)), Y, S * sizeof(*Y))
|
||||
#define vec_remove(A,I,N) memmove((char*)A+I*sizeof(*A),(char*)A+(I+N)*sizeof(*A),sizeof(*A)*(vec_meta(A)->used-I-N)),vec_meta(A)->used-=(N)
|
||||
#define vec_append(A,N,S) memcpy(vec_add(A, N), (S), (N) * sizeof(*(S)))
|
||||
#define vec_upload(X,Y,S) memcpy(vec_add(X, (S) * sizeof(*(Y))), (Y), (S) * sizeof(*(Y)))
|
||||
#define vec_remove(A,I,N) memmove((A)+(I),(A)+((I)+(N)),sizeof(*(A))*(vec_meta(A)->used-(I)-(N))),vec_meta(A)->used-=(N)
|
||||
|
||||
typedef struct hash_table_t {
|
||||
size_t size;
|
||||
|
|
Loading…
Reference in a new issue