diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-09-12 15:21:20 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-09-21 10:12:51 -0700 |
commit | b29ec31854ca110ffcf9e1fd30c4d6f8321d3059 (patch) | |
tree | 0afe7edf10817a02287a2c256fa31d460dd88ecc /src | |
parent | be56f8a788582011db8c0909178ba8267c1eba36 (diff) |
util: Add macro to get number of elements in dynarray
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/u_dynarray.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h index 6bea481d44b..512c0efc762 100644 --- a/src/util/u_dynarray.h +++ b/src/util/u_dynarray.h @@ -149,6 +149,7 @@ util_dynarray_trim(struct util_dynarray *buf) #define util_dynarray_element(buf, type, idx) ((type*)(buf)->data + (idx)) #define util_dynarray_begin(buf) ((buf)->data) #define util_dynarray_end(buf) ((void*)util_dynarray_element((buf), char, (buf)->size)) +#define util_dynarray_num_elements(buf, type) ((buf)->size / sizeof(type)) #define util_dynarray_foreach(buf, type, elem) \ for (type *elem = (type *)(buf)->data; \ |