Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include	<string.h>
2
 
3
int
4
memcmp(const void *a1, const void *a2, size_t n)
5
{
6
	char *s1, *s2;
7
	unsigned c1, c2;
8
 
9
	s1 = a1;
10
	s2 = a2;
11
	while(n > 0) {
12
		c1 = *s1++;
13
		c2 = *s2++;
14
		if(c1 != c2) {
15
			if(c1 > c2)
16
				return 1;
17
			return -1;
18
		}
19
		n--;
20
	}
21
	return 0;
22
}