2
* This file has no copyright assigned and is placed in the Public Domain.
3
* This file is part of the w64 mingw-runtime package.
4
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
6
/* This source code was extracted from the Q8 package created and placed
7
in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
8
last edit: 1999/11/05 gwyn@arl.mil
10
Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
12
It supports an encoding where all char codes are mapped
13
to the *same* code values within a wchar_t or wint_t,
14
so long as no other wchar_t codes are used by the program.
18
#define __CRT__NO_INLINE
24
register const wchar_t *s1;
25
register const wchar_t *s2;
28
if ( n == 0 || s1 == s2 )
29
return 0; /* even for NULL pointers */
31
if ( (s1 != NULL) != (s2 != NULL) )
32
return s2 == NULL ? 1 : -1; /* robust */
34
for ( ; n > 0; ++s1, ++s2, --n )
42
int __cdecl wmemcmp(const wchar_t *_S1,const wchar_t *_S2,size_t _N)
44
if (_N == 0 || _S1 == _S2)
45
return 0; /* even for NULL pointers */
47
if ((_S1 != NULL) != (_S2 != NULL))
48
return _S2 == NULL ? 1 : -1; /* robust */
50
for ( ; 0 < _N; ++_S1, ++_S2, --_N)
52
return (*_S1 < *_S2 ? -1 : +1);