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)).

class Utils
static
void*
arrayBinarySearch

Parameters

array void*

the sorted input array

numElements uint

number of elements in the array

elementSize gsize

size of every element in bytes

searchFunc GCompareDataFunc

function to compare two elements, search_data will always be passed as second argument. [scope call]

mode GstSearchMode

search mode that should be used

searchData void*

element that should be found

userData void*

data to pass to search_func. closure

Return Value

Type: void*

The address of the found element or NULL if nothing was found. [transfer none]

Meta