toaruos/libc/wchar/wcscmp.c

18 lines
340 B
C
Raw Normal View History

2018-06-25 09:45:32 +03:00
#include <wchar.h>
int wcscmp(const wchar_t *l, const wchar_t *r) {
for (; *l == *r && *l; l++, r++);
return *(unsigned int *)l - *(unsigned int *)r;
}
2021-09-18 07:30:47 +03:00
int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) {
if (n == 0) return 0;
while (n-- && *s1 == *s2) {
if (!n || !*s1) break;
s1++;
s2++;
}
return (*s1) - (*s2);
}