diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2019-03-11 21:01:34 -0500 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-03-13 14:26:36 -0700 |
commit | 3a18f13ba50a5752e2101a6f260af782322335ff (patch) | |
tree | b932a91b0d68804ef9d63159160c6bc620d9de66 /src | |
parent | 95b001cb190dbc0ec71d760e1d9c457c1a3e4f70 (diff) | |
download | mesa-3a18f13ba50a5752e2101a6f260af782322335ff.tar.gz |
glsl/list: Add a list variant of insert_after
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
(cherry picked from commit 20c4578c5539de909e94a6acc3ad680ab2ddeca6)
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/list.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h index 59ed766f2e1..979f6fcc539 100644 --- a/src/compiler/glsl/list.h +++ b/src/compiler/glsl/list.h @@ -81,6 +81,12 @@ struct exec_node { * Insert a node in the list after the current node */ void insert_after(exec_node *after); + + /** + * Insert another list in the list after the current node + */ + void insert_after(struct exec_list *after); + /** * Insert a node in the list before the current node */ @@ -508,6 +514,21 @@ exec_list_append(struct exec_list *list, struct exec_list *source) } static inline void +exec_node_insert_list_after(struct exec_node *n, struct exec_list *after) +{ + if (exec_list_is_empty(after)) + return; + + after->tail_sentinel.prev->next = n->next; + after->head_sentinel.next->prev = n; + + n->next->prev = after->tail_sentinel.prev; + n->next = after->head_sentinel.next; + + exec_list_make_empty(after); +} + +static inline void exec_list_prepend(struct exec_list *list, struct exec_list *source) { exec_list_append(source, list); @@ -635,6 +656,11 @@ inline void exec_list::append_list(exec_list *source) exec_list_append(this, source); } +inline void exec_node::insert_after(exec_list *after) +{ + exec_node_insert_list_after(this, after); +} + inline void exec_list::prepend_list(exec_list *source) { exec_list_prepend(this, source); |