mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
AK+LibJS: Use simdutf for all base64 operations
We were previously unable to use simdutf for base64 decoding operations other than "loose". Upstream has added support for the "strict" and "stop-before-partial" operations, so let's make use of them!
This commit is contained in:
parent
e04545979f
commit
8a80ff7b3b
Notes:
github-actions[bot]
2025-05-03 15:22:03 +00:00
Author: https://github.com/trflynn89
Commit: 8a80ff7b3b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4568
6 changed files with 88 additions and 370 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Base64.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/StringView.h>
|
||||
|
@ -41,12 +42,6 @@ enum class Alphabet {
|
|||
Base64URL,
|
||||
};
|
||||
|
||||
enum class LastChunkHandling {
|
||||
Loose,
|
||||
Strict,
|
||||
StopBeforePartial,
|
||||
};
|
||||
|
||||
struct DecodeResult {
|
||||
size_t read { 0 }; // [[Read]]
|
||||
ByteBuffer bytes; // [[Bytes]]
|
||||
|
@ -56,7 +51,7 @@ struct DecodeResult {
|
|||
ThrowCompletionOr<GC::Ref<TypedArrayBase>> validate_uint8_array(VM&);
|
||||
ThrowCompletionOr<ByteBuffer> get_uint8_array_bytes(VM&, TypedArrayBase const&);
|
||||
void set_uint8_array_bytes(TypedArrayBase&, ReadonlyBytes);
|
||||
DecodeResult from_base64(VM&, StringView string, Alphabet alphabet, LastChunkHandling last_chunk_handling, Optional<size_t> max_length = {});
|
||||
DecodeResult from_base64(VM&, StringView string, Alphabet alphabet, AK::LastChunkHandling last_chunk_handling, Optional<size_t> max_length = {});
|
||||
DecodeResult from_hex(VM&, StringView string, Optional<size_t> max_length = {});
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue