mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
AK: Alter ByteBuffer to utilise memcmp.
__builtin_memcmp is already heavily utilised in AK.
This commit is contained in:
parent
d475460ea1
commit
46ca7d3cb5
1 changed files with 1 additions and 9 deletions
|
@ -38,15 +38,7 @@ bool ByteBuffer::operator==(const ByteBuffer& other) const
|
|||
return false;
|
||||
|
||||
// So they both have data, and the same length.
|
||||
// Avoid hitting conditionals in ever iteration.
|
||||
size_t n = size();
|
||||
const u8* this_data = data();
|
||||
const u8* other_data = other.data();
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
if (this_data[i] != other_data[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !__builtin_memcmp(data(), other.data(), size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue