mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 08:59:50 +00:00
AK+LibJS+LibWeb: Use simdutf to create well-formed strings
This commit is contained in:
parent
017a6cc687
commit
1375e6bf39
Notes:
github-actions[bot]
2025-07-25 22:41:55 +00:00
Author: https://github.com/trflynn89
Commit: 1375e6bf39
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5608
Reviewed-by: https://github.com/gmta ✅
9 changed files with 37 additions and 42 deletions
|
|
@ -114,6 +114,20 @@ Utf16String Utf16String::repeated(u32 code_point, size_t count)
|
|||
return builder.to_utf16_string();
|
||||
}
|
||||
|
||||
Utf16String Utf16String::to_well_formed() const
|
||||
{
|
||||
if (utf16_view().validate(AllowLonelySurrogates::No))
|
||||
return *this;
|
||||
return Utf16String { Detail::Utf16StringData::to_well_formed(*this) };
|
||||
}
|
||||
|
||||
String Utf16String::to_well_formed_utf8() const
|
||||
{
|
||||
if (utf16_view().validate(AllowLonelySurrogates::No))
|
||||
return to_utf8(AllowLonelySurrogates::No);
|
||||
return to_well_formed().to_utf8(AllowLonelySurrogates::No);
|
||||
}
|
||||
|
||||
ErrorOr<void> Formatter<Utf16String>::format(FormatBuilder& builder, Utf16String const& utf16_string)
|
||||
{
|
||||
if (utf16_string.has_long_utf16_storage())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue