fix return value of wmemcmp for extreme wchar_t values

analogous to the bug in wcscmp and wcsncmp that was fixed in commit
07616721f1.
This commit is contained in:
Rich Felker 2023-04-24 11:21:13 -04:00
parent 4724793f96
commit b928c7234f
1 changed files with 1 additions and 1 deletions

View File

@ -3,5 +3,5 @@
int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n)
{
for (; n && *l==*r; n--, l++, r++);
return n ? *l-*r : 0;
return n ? (*l < *r ? -1 : *l > *r) : 0;
}