mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:24:58 +00:00
AK: Move String::hash() and String::String() to StringBase
This commit is contained in:
parent
1b09a1851e
commit
d6290c4684
4 changed files with 16 additions and 16 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue