diff --git a/src/system/libroot/posix/string/strcmp.c b/src/system/libroot/posix/string/strcmp.c index 56e058e2cb..8ac20d9499 100644 --- a/src/system/libroot/posix/string/strcmp.c +++ b/src/system/libroot/posix/string/strcmp.c @@ -15,6 +15,18 @@ int strcmp(char const *a, char const *b) { + if ((((addr_t)a) & 3) == 0 && (((addr_t)b) & 3) == 0) { + uint32* a32 = (uint32*)a; + uint32* b32 = (uint32*)b; + + while (*a32 == *b32 && LACKS_ZERO_BYTE((*a32))) { + a32++; + b32++; + } + a = (const char *)a32; + b = (const char *)b32; + } + while (true) { int cmp = (unsigned char)*a - (unsigned char)*b++; if (cmp != 0 || *a++ == '\0')