csnip
0.1
|
Binary search algorithm. More...
Macros | |
#define | csnip_Bsearch(itype, u, au_lessthan_key, N, ret) |
Binary search. More... | |
The csnip_Bsearch() macro provides a binary seach facility that improves on libc's bsearch interface in a number of ways:
#define csnip_Bsearch | ( | itype, | |
u, | |||
au_lessthan_key, | |||
N, | |||
ret | |||
) |
Statement macro. Find the smallest index i in a sorted array such that the i-th entry is at least as large as a specified key. If no such index exists return N, the size of the array.
itype | integral type used for the return value. itype is also used for indexing. |
u | dummy variable for the comparison expression. |
au_lessthan_key | expression in u that evaluates to true if the u-th entry of the array is less than the key, and false otherwise. |
N | the size of the array. |
ret | lvalue of type itype to store the result index. |