]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libc/port/memchr.c
libc: change usize to 64-bit for amd64 and arm64, make memory(2) functions use usize
[plan9front.git] / sys / src / libc / port / memchr.c
1 #include        <u.h>
2 #include        <libc.h>
3
4 void*
5 memchr(void *ap, int c, usize n)
6 {
7         uchar *sp;
8
9         sp = ap;
10         c &= 0xFF;
11         while(n > 0) {
12                 if(*sp++ == c)
13                         return sp-1;
14                 n--;
15         }
16         return 0;
17 }