diff options
author | Chris Robinson <[email protected]> | 2014-04-09 22:50:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-04-09 22:50:28 -0700 |
commit | 90ae4b7c0f675e0a0846af376f6025ccfd8f7bc9 (patch) | |
tree | d9db59c53037cf91753dca6193cec536d0f8a8e3 /Alc/vector.h | |
parent | 023981acb9242649f1fff8b02143a26e85005a9f (diff) |
Add a VECTOR_INSERT method to insert a range of elements at once
Diffstat (limited to 'Alc/vector.h')
-rw-r--r-- | Alc/vector.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Alc/vector.h b/Alc/vector.h index 57939719..2993aac5 100644 --- a/Alc/vector.h +++ b/Alc/vector.h @@ -35,6 +35,9 @@ ALboolean vector_resize(void *ptr, size_t base_size, size_t obj_count, size_t ob #define VECTOR_ITER_BEGIN(_x) ((_x)->Data) #define VECTOR_ITER_END(_x) ((_x)->Data + VECTOR_SIZE((_x))) +ALboolean vector_insert(void *ptr, size_t base_size, size_t obj_size, ptrdiff_t ins_elem, const void *datstart, ptrdiff_t numins); +#define VECTOR_INSERT(_x, _i, _s, _e) (vector_insert(&(_x), sizeof(*(_x)), sizeof((_x)->Data[0]), (_i)-VECTOR_ITER_BEGIN(_x), (_s), (_e)-(_s))) + #define VECTOR_PUSH_BACK(_x, _obj) (vector_reserve(&(_x), sizeof(*(_x)), VECTOR_SIZE(_x)+1, sizeof((_x)->Data[0]), AL_FALSE) && \ (((_x)->Data[(_x)->Size++] = (_obj)),AL_TRUE)) #define VECTOR_POP_BACK(_x) ((void)((_x)->Size--)) |