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	<u.h>
2
#include	<libc.h>
3
 
4
int
5
memcmp(void *a1, void *a2, ulong 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
}