The optimised aligned version was broken and not used.
As pointed out by Hamish the alignment used && in second case instead of &, which meant it was never used. Another error when a32 was 0xFF000000 and b32 was 0xFF00FFFF would return a non zero value. A simple fix for the issues with going over to the byte by byte comparison failed, so rather than leave broken code I remove this for the time being. Not the best code I've written obviously.
This commit is contained in:
@@ -15,19 +15,6 @@
|
||||
int
|
||||
strcmp(char const *a, char const *b)
|
||||
{
|
||||
/* Make sure we don't pass page boundries on a or b when doing four byte
|
||||
comparisons */
|
||||
if ((((addr_t)a) & 3) == 0 && (((addr_t)b) && 3) == 0) {
|
||||
uint32* a32 = (uint32*)a;
|
||||
uint32* b32 = (uint32*)b;
|
||||
|
||||
while (LACKS_ZERO_BYTE(*a32)) {
|
||||
int32 cmp = *a32++ - *b32++;
|
||||
if (cmp != 0)
|
||||
return cmp;
|
||||
}
|
||||
return *a32 - *b32;
|
||||
}
|
||||
while (true) {
|
||||
int cmp = (unsigned char)*a - (unsigned char)*b++;
|
||||
if (cmp != 0 || *a++ == '\0')
|
||||
|
||||
Reference in New Issue
Block a user