CString: Add strcmp()

This commit is contained in:
apio 2022-12-19 12:20:56 +01:00
parent 60520dff4c
commit 9eb829f3a2
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 11 additions and 0 deletions

View File

@ -8,6 +8,7 @@ extern "C"
int memcmp(const void* a, const void* b, usize n);
void* memmove(void* dest, const void* src, usize n);
usize strlen(const char* str);
int strcmp(const char* a, const char* b);
usize wcslen(const wchar_t* str);

View File

@ -46,6 +46,16 @@ extern "C"
return (usize)(i - str);
}
int strcmp(const char* a, const char* b)
{
while (*a && (*a == *b))
{
a++;
b++;
}
return *(const u8*)a - *(const u8*)b;
}
usize wcslen(const wchar_t* str)
{
const wchar_t* i = str;