mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 14:40:13 +01:00
anv/util: Add helpers for getting the first and last elements of a vector
This commit is contained in:
parent
95487668df
commit
219a1929f7
1 changed files with 15 additions and 0 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue