|
Calico
|
Binary search. More...
Functions | |
| static int | cal_binary_search (const void *key, const void *ptr, size_t count, size_t size, int(*cmp)(void *, const void *, const void *), void *cmp_ctx, size_t *pos_out) |
Perform a binary search on a sorted array pointed by ptr. More... | |
Binary search.
|
inlinestatic |
Perform a binary search on a sorted array pointed by ptr.
If the search was successful, 1 is returned and *pos_out is set to the index of the element that compares equal to key. Otherwise, 0 is returned and *pos_out is set to the index of the smallest element greater than key. pos_out is optional and can be null.