mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
AK: Shrink Utf16View
Use a sentinel value instead of Optional for the cached length in code points, shrinking Utf16View from 32 to 24 bytes.
This commit is contained in:
parent
7628ddfaf7
commit
0c93a07fb1
Notes:
github-actions[bot]
2025-04-16 08:05:52 +00:00
Author: https://github.com/awesomekling
Commit: 0c93a07fb1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4370
2 changed files with 3 additions and 3 deletions
|
@ -177,9 +177,9 @@ ErrorOr<String> Utf16View::to_utf8(AllowInvalidCodeUnits allow_invalid_code_unit
|
|||
|
||||
size_t Utf16View::length_in_code_points() const
|
||||
{
|
||||
if (!m_length_in_code_points.has_value())
|
||||
if (m_length_in_code_points == NumericLimits<size_t>::max())
|
||||
m_length_in_code_points = calculate_length_in_code_points();
|
||||
return *m_length_in_code_points;
|
||||
return m_length_in_code_points;
|
||||
}
|
||||
|
||||
u16 Utf16View::code_unit_at(size_t index) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue