[Mesa-dev] [PATCH] glsl/list: Add a foreach_list_typed_safe_reverse macro
--- src/glsl/list.h | 9 + 1 file changed, 9 insertions(+) diff --git a/src/glsl/list.h b/src/glsl/list.h index 1d18ec9..1fb9178 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -673,4 +673,13 @@ inline void exec_node::insert_before(exec_list *before) __node = __next, __next = \ exec_node_data(__type, (__next)-__field.next, __field)) +#define foreach_list_typed_safe_reverse(__type, __node, __field, __list) \ + for (__type * __node = \ + exec_node_data(__type, (__list)-tail_pred, __field), \ + * __prev = \ + exec_node_data(__type, (__node)-__field.prev, __field);\ +__prev != NULL;\ +__node = __prev, __prev = \ + exec_node_data(__type, (__prev)-__field.prev, __field)) + #endif /* LIST_CONTAINER_H */ -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/list: Add a foreach_list_typed_safe_reverse macro
FWIW, Ian commented on my patch to add foreach_list_typed_reverse that we shouldn't merge it until it had users so people wouldn't try to remove it -- it seems like this has the same issue. So either merge both of them at the same time, or neither until NIR gets merged... Connor On Fri, Nov 7, 2014 at 9:32 PM, Jason Ekstrand ja...@jlekstrand.net wrote: --- src/glsl/list.h | 9 + 1 file changed, 9 insertions(+) diff --git a/src/glsl/list.h b/src/glsl/list.h index 1d18ec9..1fb9178 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -673,4 +673,13 @@ inline void exec_node::insert_before(exec_list *before) __node = __next, __next = \ exec_node_data(__type, (__next)-__field.next, __field)) +#define foreach_list_typed_safe_reverse(__type, __node, __field, __list) \ + for (__type * __node = \ + exec_node_data(__type, (__list)-tail_pred, __field), \ + * __prev = \ + exec_node_data(__type, (__node)-__field.prev, __field);\ +__prev != NULL;\ +__node = __prev, __prev = \ + exec_node_data(__type, (__prev)-__field.prev, __field)) + #endif /* LIST_CONTAINER_H */ -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/list: Add a foreach_list_typed_safe_reverse macro
On Fri, Nov 7, 2014 at 8:57 PM, Connor Abbott cwabbo...@gmail.com wrote: FWIW, Ian commented on my patch to add foreach_list_typed_reverse that we shouldn't merge it until it had users so people wouldn't try to remove it -- it seems like this has the same issue. So either merge both of them at the same time, or neither until NIR gets merged... Fair enough. This at least gets it on the list for review. Connor On Fri, Nov 7, 2014 at 9:32 PM, Jason Ekstrand ja...@jlekstrand.net wrote: --- src/glsl/list.h | 9 + 1 file changed, 9 insertions(+) diff --git a/src/glsl/list.h b/src/glsl/list.h index 1d18ec9..1fb9178 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -673,4 +673,13 @@ inline void exec_node::insert_before(exec_list *before) __node = __next, __next = \ exec_node_data(__type, (__next)-__field.next, __field)) +#define foreach_list_typed_safe_reverse(__type, __node, __field, __list) \ + for (__type * __node = \ + exec_node_data(__type, (__list)-tail_pred, __field), \ + * __prev = \ + exec_node_data(__type, (__node)-__field.prev, __field); \ +__prev != NULL; \ +__node = __prev, __prev = \ + exec_node_data(__type, (__prev)-__field.prev, __field)) + #endif /* LIST_CONTAINER_H */ -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl/list: Add a foreach_list_typed_safe_reverse macro
Reviewed-by: Matt Turner matts...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev