ref: f6da1ab12d14fe4db7a76f390d6dfc85de660f1c
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;
}