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