summaryrefslogtreecommitdiff
path: root/src/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vector.h b/src/vector.h
index d318463c6..e8a967813 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -95,4 +95,14 @@ GIT_INLINE(void) git_vector_set_cmp(git_vector *v, git_vector_cmp cmp)
}
}
+/** Swap two elements */
+#define git_vector_swap_elements(V, P1, P2) do { \
+ void *__t = (V)->contents[P1]; \
+ (V)->contents[P1] = (V)->contents[P2]; \
+ (V)->contents[P2] = __t; } while (0)
+
+/** Compare two elements */
+#define git_vector_cmp_elements(V, P1, P2) \
+ (V)->_cmp(git_vector_get(V,P1), git_vector_get(V,P2))
+
#endif