1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

LibC: Implement wmemcmp

This commit is contained in:
Daniel Bertalan 2021-10-16 09:52:54 +02:00 committed by Linus Groh
parent 685045176b
commit 57f0c12b9a
2 changed files with 10 additions and 0 deletions

View file

@ -541,4 +541,13 @@ size_t mbsrtowcs(wchar_t* dst, const char** src, size_t len, mbstate_t* ps)
// If we are here, we have written `len` wchars, but not reached the null byte.
return written;
}
int wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n)
{
while (n-- > 0) {
if (*s1++ != *s2++)
return s1[-1] < s2[-1] ? -1 : 1;
}
return 0;
}
}