4 ** 1998-06-17, Ullrich von Bassewitz
5 ** 2015-06-21, Greg King
14 void* __fastcall__ bsearch (const void* key, const void* base, size_t n,
15 size_t size, int __fastcall__ (* cmp) (const void*, const void*))
24 while (first <= last) {
26 /* Set current to mid of range */
27 current = (last + first) / 2;
30 result = cmp ((void*) (((int) base) + current*size), key);
36 /* Found one entry that matches the search key. However there may be
37 ** more than one entry with the same key value and ANSI guarantees
38 ** that we return the first of a row of items with the same key.
45 /* Did we find the entry? */
46 return (void*) (found? ((int) base) + first*size : 0);