libc: fix wrong argument order to bsearch comparator

This commit is contained in:
K. Lange 2023-04-22 08:18:18 +09:00
parent 204d80496d
commit 5e9efbac4b

View File

@ -7,7 +7,7 @@ void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
size_t i = 0; size_t i = 0;
while (i < nmemb) { while (i < nmemb) {
const void * a = b; const void * a = b;
if (!compar(a,key)) return (void *)a; if (!compar(key,a)) return (void *)a;
i++; i++;
b += size; b += size;
} }