xref: /haiku/src/system/libroot/posix/string/memcmp.c (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2 ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 
6 #include <sys/types.h>
7 #include <string.h>
8 
9 
10 int
11 memcmp(const void *cs, const void *ct, size_t count)
12 {
13 	const unsigned char *su1, *su2;
14 	signed char res = 0;
15 
16 	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
17 		if ((res = *su1 - *su2) != 0)
18 			break;
19 	return res;
20 }
21