1 |
From 3a18f13ba50a5752e2101a6f260af782322335ff Mon Sep 17 00:00:00 2001 |
2 |
From: Jason Ekstrand <jason.ekstrand@intel.com> |
3 |
Date: Mon, 11 Mar 2019 21:01:34 -0500 |
4 |
Subject: [PATCH 06/22] glsl/list: Add a list variant of insert_after |
5 |
|
6 |
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> |
7 |
Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> |
8 |
|
9 |
(cherry picked from commit 20c4578c5539de909e94a6acc3ad680ab2ddeca6) |
10 |
--- |
11 |
src/compiler/glsl/list.h | 26 ++++++++++++++++++++++++++ |
12 |
1 file changed, 26 insertions(+) |
13 |
|
14 |
diff --git a/src/compiler/glsl/list.h b/src/compiler/glsl/list.h |
15 |
index 59ed766f2e1..979f6fcc539 100644 |
16 |
--- a/src/compiler/glsl/list.h |
17 |
+++ b/src/compiler/glsl/list.h |
18 |
@@ -81,6 +81,12 @@ struct exec_node { |
19 |
* Insert a node in the list after the current node |
20 |
*/ |
21 |
void insert_after(exec_node *after); |
22 |
+ |
23 |
+ /** |
24 |
+ * Insert another list in the list after the current node |
25 |
+ */ |
26 |
+ void insert_after(struct exec_list *after); |
27 |
+ |
28 |
/** |
29 |
* Insert a node in the list before the current node |
30 |
*/ |
31 |
@@ -507,6 +513,21 @@ exec_list_append(struct exec_list *list, struct exec_list *source) |
32 |
exec_list_make_empty(source); |
33 |
} |
34 |
|
35 |
+static inline void |
36 |
+exec_node_insert_list_after(struct exec_node *n, struct exec_list *after) |
37 |
+{ |
38 |
+ if (exec_list_is_empty(after)) |
39 |
+ return; |
40 |
+ |
41 |
+ after->tail_sentinel.prev->next = n->next; |
42 |
+ after->head_sentinel.next->prev = n; |
43 |
+ |
44 |
+ n->next->prev = after->tail_sentinel.prev; |
45 |
+ n->next = after->head_sentinel.next; |
46 |
+ |
47 |
+ exec_list_make_empty(after); |
48 |
+} |
49 |
+ |
50 |
static inline void |
51 |
exec_list_prepend(struct exec_list *list, struct exec_list *source) |
52 |
{ |
53 |
@@ -635,6 +656,11 @@ inline void exec_list::append_list(exec_list *source) |
54 |
exec_list_append(this, source); |
55 |
} |
56 |
|
57 |
+inline void exec_node::insert_after(exec_list *after) |
58 |
+{ |
59 |
+ exec_node_insert_list_after(this, after); |
60 |
+} |
61 |
+ |
62 |
inline void exec_list::prepend_list(exec_list *source) |
63 |
{ |
64 |
exec_list_prepend(this, source); |
65 |
-- |
66 |
2.21.0 |
67 |
|