OSDN Git Service

glsl/list: Add an exec_list_is_singular() helper.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 8 Apr 2019 18:10:08 +0000 (11:10 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 29 Apr 2019 05:35:42 +0000 (22:35 -0700)
Similar to list_is_singular() in util/list.h.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/compiler/glsl/list.h

index 979f6fc..ed77dcf 100644 (file)
@@ -372,6 +372,13 @@ exec_list_is_empty(const struct exec_list *list)
    return list->head_sentinel.next == &list->tail_sentinel;
 }
 
+static inline bool
+exec_list_is_singular(const struct exec_list *list)
+{
+   return !exec_list_is_empty(list) &&
+          list->head_sentinel.next->next == &list->tail_sentinel;
+}
+
 static inline const struct exec_node *
 exec_list_get_head_const(const struct exec_list *list)
 {