mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Add a median_int32 and find_nth_int32
This commit is contained in:
parent
3de5ac9baa
commit
0edc39303d
@ -1220,6 +1220,7 @@ IMPLEMENT_ORDER_FUNC(find_nth_int, int)
|
||||
IMPLEMENT_ORDER_FUNC(find_nth_time, time_t)
|
||||
IMPLEMENT_ORDER_FUNC(find_nth_double, double)
|
||||
IMPLEMENT_ORDER_FUNC(find_nth_uint32, uint32_t)
|
||||
IMPLEMENT_ORDER_FUNC(find_nth_int32, int32_t)
|
||||
IMPLEMENT_ORDER_FUNC(find_nth_long, long)
|
||||
|
||||
/** Return a newly allocated digestset_t, optimized to hold a total of
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user