util_array_binary_search
function util_array_binary_search(array:gpointer, num_elements:Number, element_size:gsize, search_func:GLib.CompareDataFunc, mode:Gst.SearchMode, search_data:gpointer):gpointer { // Gjs wrapper for gst_util_array_binary_search() }
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)).
- array
the sorted input array
- num_elements
number of elements in the array
- element_size
size of every element in bytes
- search_func
function to compare two elements, search_data will always be passed as second argument
- mode
search mode that should be used
- search_data
element that should be found
- Returns
The address of the found element or null if nothing was found