4 * Ullrich von Bassewitz, 17.06.1998
13 void* bsearch (void* key, void* base, size_t n, size_t size, int (*cmp) (void*, void*))
22 while (first <= last) {
24 /* Set current to mid of range */
25 current = (last + first) / 2;
28 result = cmp ((void*) (((int) base) + current*size), key);
34 /* Found one entry that matches the search key. However there may be
35 * more than one entry with the same key value and ANSI guarantees
36 * that we return the first of a row of items with the same key.
43 /* Did we find the entry? */
44 return (void*) (found? ((int) base) + first*size : 0);