298 /** |
298 /** |
299 * Searches the largest lower bound in a sorted array. |
299 * Searches the largest lower bound in a sorted array. |
300 * |
300 * |
301 * In other words, this function returns the index of the largest element |
301 * In other words, this function returns the index of the largest element |
302 * in \p arr that is less or equal to \p elem with respect to \p cmp_func. |
302 * in \p arr that is less or equal to \p elem with respect to \p cmp_func. |
|
303 * When no such element exists, \p size is returned. |
303 * |
304 * |
304 * If \p elem is contained in the array, this is identical to |
305 * If \p elem is contained in the array, this is identical to |
305 * #cx_array_binary_search(). |
306 * #cx_array_binary_search(). |
306 * |
307 * |
307 * If the array is not sorted with respect to the \p cmp_func, the behavior |
308 * If the array is not sorted with respect to the \p cmp_func, the behavior |
310 * @param arr the array to search |
311 * @param arr the array to search |
311 * @param size the size of the array |
312 * @param size the size of the array |
312 * @param elem_size the size of one element |
313 * @param elem_size the size of one element |
313 * @param elem the element to find |
314 * @param elem the element to find |
314 * @param cmp_func the compare function |
315 * @param cmp_func the compare function |
315 * @return the index of the closest element in the array |
316 * @return the index of the largest upper bound, or \p size |
316 */ |
317 */ |
317 size_t cx_array_binary_search_inf( |
318 size_t cx_array_binary_search_inf( |
318 void const *arr, |
319 void const *arr, |
319 size_t size, |
320 size_t size, |
320 size_t elem_size, |
321 size_t elem_size, |