summaryrefslogtreecommitdiffhomepage
path: root/src/string/ntapi_tt_strncmp_multibyte.c
blob: d66865dc16ec8aaaa4b37142cd760fadb8b0ff51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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_multibyte(
	__in	const char *	a,
	__in	const char *	b,
	__in	size_t		n)
{
	if (n == 0)
		return 0;

	for (--n; n && (*a == *b) && *a; a++, b++)
		n--;

	return (int)*a - (int)*b;
}