ref: 746e0c9217ab9ee1884b721a955b712d59b13549
dir: /kern/memchr.c/
#include <u.h>
#include <libc.h>
void*
sysmemchr(void *ap, int c, ulong n)
{
uchar *sp;
ulong i;
i = n;
sp = (uchar *)ap;
c &= 0xFF;
while(i > 0) {
if(*sp++ == c)
return sp-1;
i--;
}
return 0;
}