ReactOS 0.4.16-dev-927-g467dec4
wcsncmp.cpp
Go to the documentation of this file.
1//
2// wcsncmp.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines wcsncmp(), which compares two wide character strings, determining
7// their ordinal order. The function tests at most 'count' characters.
8//
9// Note that the comparison is performed with unsigned elements (wchar_t is
10// unsigned in this implementation), so the null character (0) is less than
11// all other characters.
12//
13// Returns:
14// * a negative value if a < b
15// * zero if a == b
16// * a positive value if a > b
17//
18#include <string.h>
19
20
21
22#ifdef _M_ARM
23 #pragma function(wcsncmp)
24#endif
25
26
27
28extern "C" int __cdecl wcsncmp(
29 wchar_t const* a,
30 wchar_t const* b,
31 size_t count
32 )
33{
34 if (count == 0)
35 return 0;
36
37 while (--count != 0 && *a && *a == *b)
38 {
39 ++a;
40 ++b;
41 }
42
43 return static_cast<int>(*a - *b);
44}
#define __cdecl
Definition: accygwin.h:79
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define b
Definition: ke_i.h:79
int __cdecl wcsncmp(wchar_t const *a, wchar_t const *b, size_t count)
Definition: wcsncmp.cpp:28