aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-07-27 00:44:52 -0700
committerDave Barach <openvpp@barachs.net>2018-07-27 12:02:44 +0000
commitfc5dda3d0a96fd9722cdac055dfa4865823d5ebd (patch)
tree1ef49d44e0ac4fdbcca01275bb6832ebbb4bc1c0
parentd7f58cc4f0ab6d98dc57da52a8665b495493049e (diff)
vector indicies walk in reverse
Change-Id: Iddc8a940601230f8b209c5601e4e5bd04b103c6a Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
-rw-r--r--src/vppinfra/vec_bootstrap.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vppinfra/vec_bootstrap.h b/src/vppinfra/vec_bootstrap.h
index 6db83f23f72..bff688965b4 100644
--- a/src/vppinfra/vec_bootstrap.h
+++ b/src/vppinfra/vec_bootstrap.h
@@ -191,6 +191,10 @@ for (var = vec_end (vec) - 1; var >= (vec); var--)
/** \brief Iterate over vector indices. */
#define vec_foreach_index(var,v) for ((var) = 0; (var) < vec_len (v); (var)++)
+/** \brief Iterate over vector indices (reverse). */
+#define vec_foreach_index_backwards(var,v) \
+ for ((var) = vec_len((v)) - 1; (var) >= 0; (var)--)
+
#endif /* included_clib_vec_bootstrap_h */
/*