/**
 *  Optimized string comparison ANSI C implementation
 *  Copyright (C) 2010 Matous Jan Fialka, <http://mjf.cz/>
 *  Released under the terms of The MIT License
 */

int
strncmp(const char *s, const char *t, size_t n)
{
	unsigned char a = 0, b = 0;

	while(n > 0 ? (a = *s++) == (b = *t++) : 0)
		--n;
	return (int)a - (int)b;
}
