mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-04-05 04:06:08 +00:00
AK: Move String::hash() and String::String() to StringBase
This commit is contained in:
committed by
Andrew Kaster
parent
1b09a1851e
commit
d6290c4684
@@ -66,6 +66,15 @@ ReadonlyBytes StringBase::bytes() const
|
||||
return m_data->bytes();
|
||||
}
|
||||
|
||||
u32 StringBase::hash() const
|
||||
{
|
||||
if (is_short_string()) {
|
||||
auto bytes = this->bytes();
|
||||
return string_hash(reinterpret_cast<char const*>(bytes.data()), bytes.size());
|
||||
}
|
||||
return m_data->hash();
|
||||
}
|
||||
|
||||
bool StringBase::operator==(StringBase const& other) const
|
||||
{
|
||||
if (is_short_string())
|
||||
|
||||
Reference in New Issue
Block a user