Module: Mesa
Branch: master
Commit: 28c4fd4bc6a5417d73dcbc11e022d82ebabc5b36
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=28c4fd4bc6a5417d73dcbc11e022d82ebabc5b36

Author: Connor Abbott <[email protected]>
Date:   Tue Jul  8 12:20:58 2014 -0700

exec_list: Add a prepend function.

This complements the existing append function. It's implemented in a
rather simple way right now; it could be changed if performance is a
concern.

Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Signed-off-by: Connor Abbott <[email protected]>

---

 src/glsl/list.h |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/glsl/list.h b/src/glsl/list.h
index a4444bd..66028f6 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -345,9 +345,15 @@ struct exec_list {
    void move_nodes_to(exec_list *target);
 
    /**
-    * Append all nodes from the source list to the target list
+    * Append all nodes from the source list to the end of the target list
     */
    void append_list(exec_list *source);
+
+   /**
+    * Prepend all nodes from the source list to the beginning of the target
+    * list
+    */
+   void prepend_list(exec_list *source);
 #endif
 };
 
@@ -479,6 +485,13 @@ exec_list_append(struct exec_list *list, struct exec_list 
*source)
 }
 
 static inline void
+exec_list_prepend(struct exec_list *list, struct exec_list *source)
+{
+   exec_list_append(source, list);
+   exec_list_move_nodes_to(source, list);
+}
+
+static inline void
 exec_node_insert_list_before(struct exec_node *n, struct exec_list *before)
 {
    if (exec_list_is_empty(before))
@@ -554,6 +567,11 @@ inline void exec_list::append_list(exec_list *source)
    exec_list_append(this, source);
 }
 
+inline void exec_list::prepend_list(exec_list *source)
+{
+   exec_list_prepend(this, source);
+}
+
 inline void exec_node::insert_before(exec_list *before)
 {
    exec_node_insert_list_before(this, before);

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to