update for HEAD-2003021201
[reactos.git] / lib / msvcrt / wstring / wcsncmp.c
1 #include <msvcrt/wchar.h>
2
3 #if 0
4
5 int wcsncmp(const wchar_t* cs, const wchar_t* ct, size_t count)
6 {
7   while ((*cs) == (*ct) && count > 0) {
8     if (*cs == 0)
9       return 0;
10     cs++;
11     ct++;
12     count--;
13   }
14   return (*cs) - (*ct);
15 }
16
17 #else
18
19 int wcsncmp(const wchar_t* cs, const wchar_t* ct, size_t count)
20 {
21   if (count == 0)
22     return 0;
23   do {
24     if (*cs != *ct++)
25       //return *(unsigned const char *)cs - *(unsigned const char *)--ct;
26       return (*cs) - (*(--ct));
27     if (*cs++ == 0)
28       break;
29   } while (--count != 0);
30   return 0;
31 }
32
33 #endif