mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-23 13:18:59 +00:00
29 lines
477 B
C
29 lines
477 B
C
/*
|
|
* Derived from:
|
|
* http://www.kernel.org/pub/linux/libs/klibc/
|
|
*/
|
|
/*
|
|
* strcmp.c
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#ifdef BFLB_IN_BENCHMARK
|
|
int bflb_strcmp(const char *s1, const char *s2)
|
|
#else
|
|
int strcmp(const char *s1, const char *s2)
|
|
#endif
|
|
{
|
|
const unsigned char *c1 = (const unsigned char *)s1;
|
|
const unsigned char *c2 = (const unsigned char *)s2;
|
|
unsigned char ch;
|
|
int d = 0;
|
|
|
|
while (1) {
|
|
d = (int)(ch = *c1++) - (int)*c2++;
|
|
if (d || !ch)
|
|
break;
|
|
}
|
|
|
|
return d;
|
|
}
|