xref: /haiku/src/system/libroot/posix/wchar/wmemcmp.c (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
5 
6 #include <wchar_private.h>
7 
8 
9 int
10 __wmemcmp(const wchar_t* wcs1, const wchar_t* wcs2, size_t count)
11 {
12 	while (count-- > 0) {
13 		const wchar_t wc1 = *wcs1++;
14 		const wchar_t wc2 = *wcs2++;
15 		if (wc1 > wc2)
16 			return 1;
17 		else if (wc2 > wc1)
18 			return -1;
19 	}
20 
21 	return 0;
22 }
23 
24 
25 B_DEFINE_WEAK_ALIAS(__wmemcmp, wmemcmp);
26