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