summaryrefslogtreecommitdiff
path: root/missing/memcmp.c
blob: 762eaf5260524cd19d34e35c290af3ca6e9cfed3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * memcmp --- compare memories.
 *
 */

int
memcmp(s1,s2,len)
    char *s1;
    char *s2;
    register int len;
{
    register unsigned char *a = (unsigned char*)s1;
    register unsigned char *b = (unsigned char*)s2;
    register int tmp;

    while (len--) {
	if (tmp = *a++ - *b++)
	    return tmp;
    }
    return 0;
}