summaryrefslogtreecommitdiffhomepage
path: root/src/string/ntapi_tt_strncmp_utf16.c
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-28 15:42:54 -0400
committermidipix <writeonce@midipix.org>2016-06-28 19:46:41 -0400
commita2ea1bdf70166f887457b5462332d2df4f6f54c5 (patch)
tree4ab3559d0e526fc7df2d59edcaec53ccf277430c /src/string/ntapi_tt_strncmp_utf16.c
parent964eed7331c807e553ec42637151fda21b5495d9 (diff)
downloadntapi-a2ea1bdf70166f887457b5462332d2df4f6f54c5.tar.bz2
ntapi-a2ea1bdf70166f887457b5462332d2df4f6f54c5.tar.xz
string functions: added __ntapi_tt_strncmp_utf16().
Diffstat (limited to 'src/string/ntapi_tt_strncmp_utf16.c')
-rw-r--r--src/string/ntapi_tt_strncmp_utf16.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/string/ntapi_tt_strncmp_utf16.c b/src/string/ntapi_tt_strncmp_utf16.c
new file mode 100644
index 0000000..ddac803
--- /dev/null
+++ b/src/string/ntapi_tt_strncmp_utf16.c
@@ -0,0 +1,22 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013--2016 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+#include <psxtypes/psxtypes.h>
+#include <ntapi/nt_string.h>
+
+int __cdecl __ntapi_tt_strncmp_utf16(
+ __in const wchar16_t * a,
+ __in const wchar16_t * b,
+ __in size_t n)
+{
+ if ((n /= sizeof(wchar16_t)) == 0)
+ return 0;
+
+ for (--n; n && (*a == *b) && *a; a++, b++)
+ n--;
+
+ return (int)*a - (int)*b;
+}