aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-09-14 23:14:03 -0400
committerNick Mathewson <nickm@torproject.org>2009-09-14 23:21:52 -0400
commit0edc39303d32537ed95c171de6a7ad0f068b60df (patch)
tree4ddbc13de8a7ad09c8343eabb6cf6fb68d022311 /src/common/container.h
parent3de5ac9baa7dc12f5bc441d75a8be48995e0f3a8 (diff)
downloadtor-0edc39303d32537ed95c171de6a7ad0f068b60df.tar
tor-0edc39303d32537ed95c171de6a7ad0f068b60df.tar.gz
Add a median_int32 and find_nth_int32
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/container.h b/src/common/container.h
index e62655246..4495a7a27 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -627,6 +627,7 @@ void digestset_free(digestset_t* set);
int find_nth_int(int *array, int n_elements, int nth);
time_t find_nth_time(time_t *array, int n_elements, int nth);
double find_nth_double(double *array, int n_elements, int nth);
+int32_t find_nth_int32(int32_t *array, int n_elements, int nth);
uint32_t find_nth_uint32(uint32_t *array, int n_elements, int nth);
long find_nth_long(long *array, int n_elements, int nth);
static INLINE int
@@ -649,6 +650,11 @@ median_uint32(uint32_t *array, int n_elements)
{
return find_nth_uint32(array, n_elements, (n_elements-1)/2);
}
+static INLINE int32_t
+median_int32(int32_t *array, int n_elements)
+{
+ return find_nth_int32(array, n_elements, (n_elements-1)/2);
+}
static INLINE long
median_long(long *array, int n_elements)
{