Utils.arrayBinarySearch

Searches inside @array for @search_data by using the comparison function @search_func. @array must be sorted ascending.

As @search_data is always passed as second argument to @search_func it's not required that @search_data has the same type as the array elements.

The complexity of this search function is O(log (num_elements)).

struct Utils
static
void*
arrayBinarySearch

Parameters

array void*

the sorted input array

numElements uint

number of elements in the array

elementSize size_t

size of every element in bytes

searchFunc GCompareDataFunc

function to compare two elements, @search_data will always be passed as second argument

mode GstSearchMode

search mode that should be used

searchData void*

element that should be found

userData void*

data to pass to @search_func

Return Value

Type: void*

The address of the found element or %NULL if nothing was found

Meta