summaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2014-07-24 14:31:49 +0300
committerNick Mathewson <nickm@torproject.org>2014-09-09 12:28:15 -0400
commit01800ea1e4e0312c8b204541a8e43d7aad67ad61 (patch)
tree83d81a65e11e78644055a0a39cdbd77ebe02bfd9 /src/common/container.h
parent8e3939519999f73fadad1a8b8cff75aad0667312 (diff)
downloadtor-01800ea1e4e0312c8b204541a8e43d7aad67ad61.tar.gz
tor-01800ea1e4e0312c8b204541a8e43d7aad67ad61.zip
Add unittests for finding the third quartile of a set.
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 26ac85120d..c3756c83a6 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -689,5 +689,11 @@ median_int32(int32_t *array, int n_elements)
return find_nth_int32(array, n_elements, (n_elements-1)/2);
}
+static INLINE uint32_t
+third_quartile_uint32(uint32_t *array, int n_elements)
+{
+ return find_nth_uint32(array, n_elements, (n_elements*3)/4);
+}
+
#endif