1/* 2** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved. 3** Distributed under the terms of the MIT License. 4*/ 5 6#include <wchar_private.h> 7 8 9int 10__wcsncmp(const wchar_t* wcs1, const wchar_t* wcs2, size_t count) 11{ 12 int cmp = 0; 13 14 while (count-- > 0) { 15 cmp = *wcs1 - *wcs2++; 16 /* note: won't overflow, since our wchar_t is guaranteed to never 17 have the highest bit set */ 18 19 if (cmp != 0 || *wcs1++ == L'\0') 20 break; 21 } 22 23 return cmp; 24} 25 26 27B_DEFINE_WEAK_ALIAS(__wcsncmp, wcsncmp); 28