summaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/vec.h')
-rw-r--r--gcc/vec.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index e6c42bc0a60..a652250112d 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -190,6 +190,13 @@ along with GCC; see the file COPYING3. If not see
#define VEC_iterate(T,V,I,P) (VEC_OP(T,base,iterate)(VEC_BASE(V),I,&(P)))
+/* Convenience macro for reverse iteration. */
+
+#define FOR_EACH_VEC_ELT_REVERSE(T,V,I,P) \
+ for (I = VEC_length (T, (V)) - 1; \
+ VEC_iterate (T, (V), (I), (P)); \
+ (I)--)
+
/* Allocate new vector.
VEC(T,A) *VEC_T_A_alloc(int reserve);