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