1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <lib9.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; }