summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/util/u_dynarray.h1
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; \