1 --- bsearch.c.bsdnew 2009-11-13 14:11:48.000000000 -0800
2 +++ bsearch.c 2009-11-13 14:11:48.000000000 -0800
3 @@ -77,3 +77,31 @@ bsearch(key, base0, nmemb, size, compar)
10 +bsearch_b(key, base0, nmemb, size, compar)
15 + int (^compar)(const void *, const void *);
17 + const char *base = base0;
22 + for (lim = nmemb; lim != 0; lim >>= 1) {
23 + p = base + (lim >> 1) * size;
24 + cmp = compar(key, p);
27 + if (cmp > 0) { /* key > p: move right */
28 + base = (char *)p + size;
30 + } /* else move left */
34 +#endif /* __BLOCKS__ */