summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_private.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-09-21 17:12:58 -0700
committerJason Ekstrand <[email protected]>2015-09-28 16:01:01 -0700
commit219a1929f7a9c3fcf0fa1cdecac592cc01dc4cf3 (patch)
tree70cc765091dca30e4c500494bd943331efc5fc5c /src/vulkan/anv_private.h
parent95487668df65185c20fb20379d1b5ba0a744c3ea (diff)
anv/util: Add helpers for getting the first and last elements of a vector
Diffstat (limited to 'src/vulkan/anv_private.h')
-rw-r--r--src/vulkan/anv_private.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h
index 6b9b12fd8ec..915460dadf4 100644
--- a/src/vulkan/anv_private.h
+++ b/src/vulkan/anv_private.h
@@ -200,6 +200,21 @@ anv_vector_length(struct anv_vector *queue)
return (queue->head - queue->tail) / queue->element_size;
}
+static inline void *
+anv_vector_head(struct anv_vector *vector)
+{
+ assert(vector->tail < vector->head);
+ return (void *)((char *)vector->data +
+ ((vector->head - vector->element_size) &
+ (vector->size - 1)));
+}
+
+static inline void *
+anv_vector_tail(struct anv_vector *vector)
+{
+ return (void *)((char *)vector->data + (vector->tail & (vector->size - 1)));
+}
+
static inline void
anv_vector_finish(struct anv_vector *queue)
{