1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

AK: Tweak ShortString bit layout slightly

Move the byte count one step to the left in order to make space
for the JS::StringOrSymbol flag.
This commit is contained in:
Andreas Kling 2025-03-18 16:58:31 -05:00 committed by Andreas Kling
parent 53da8893ac
commit 1662223e89
Notes: github-actions[bot] 2025-03-24 22:28:38 +00:00
2 changed files with 5 additions and 3 deletions

View file

@ -18,7 +18,7 @@ ReadonlyBytes ShortString::bytes() const
size_t ShortString::byte_count() const
{
return byte_count_and_short_string_flag >> 1;
return byte_count_and_short_string_flag >> StringBase::SHORT_STRING_BYTE_COUNT_SHIFT_COUNT;
}
StringBase::StringBase(NonnullRefPtr<Detail::StringData const> data)
@ -78,7 +78,7 @@ size_t StringBase::byte_count() const
{
ASSERT(!is_invalid());
if (is_short_string())
return m_short_string.byte_count_and_short_string_flag >> 1;
return m_short_string.byte_count_and_short_string_flag >> StringBase::SHORT_STRING_BYTE_COUNT_SHIFT_COUNT;
return m_data->byte_count();
}