mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
AK+LibTextCodec: Stop using Utf16View endianness override
This is preparation for removing the endianness override, since it was only used by a single client: LibTextCodec. While here, add helpers and make use of simdutf for fast conversion.
This commit is contained in:
parent
96f1f15ad6
commit
0e9480b944
Notes:
github-actions[bot]
2025-04-16 08:06:08 +00:00
Author: https://github.com/awesomekling
Commit: 0e9480b944
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4370
7 changed files with 56 additions and 53 deletions
|
@ -34,17 +34,6 @@ TEST_CASE(test_utf16be_decode)
|
|||
auto test_string = "\x00s\x00\xe4\x00k\xd8=\xde\x00"sv;
|
||||
|
||||
EXPECT(decoder.validate(test_string));
|
||||
|
||||
Vector<u32> processed_code_points;
|
||||
MUST(decoder.process(test_string, [&](u32 code_point) {
|
||||
return processed_code_points.try_append(code_point);
|
||||
}));
|
||||
EXPECT(processed_code_points.size() == 4);
|
||||
EXPECT(processed_code_points[0] == 0x73);
|
||||
EXPECT(processed_code_points[1] == 0xE4);
|
||||
EXPECT(processed_code_points[2] == 0x6B);
|
||||
EXPECT(processed_code_points[3] == 0x1F600);
|
||||
|
||||
auto utf8 = MUST(decoder.to_utf8(test_string));
|
||||
EXPECT_EQ(utf8, "säk😀"sv);
|
||||
}
|
||||
|
@ -56,17 +45,6 @@ TEST_CASE(test_utf16le_decode)
|
|||
auto test_string = "s\x00\xe4\x00k\x00=\xd8\x00\xde"sv;
|
||||
|
||||
EXPECT(decoder.validate(test_string));
|
||||
|
||||
Vector<u32> processed_code_points;
|
||||
MUST(decoder.process(test_string, [&](u32 code_point) {
|
||||
return processed_code_points.try_append(code_point);
|
||||
}));
|
||||
EXPECT(processed_code_points.size() == 4);
|
||||
EXPECT(processed_code_points[0] == 0x73);
|
||||
EXPECT(processed_code_points[1] == 0xE4);
|
||||
EXPECT(processed_code_points[2] == 0x6B);
|
||||
EXPECT(processed_code_points[3] == 0x1F600);
|
||||
|
||||
auto utf8 = MUST(decoder.to_utf8(test_string));
|
||||
EXPECT_EQ(utf8, "säk😀"sv);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue