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