-
-
Notifications
You must be signed in to change notification settings - Fork 848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LibJS: Implement the Uint8Array to/from base64 proposal #1258
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awesomekling
reviewed
Sep 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some callers (LibJS) will want to control the size of the input buffer, to decode up to a maximum length.
Did we mean "output buffer" here?
Will be used by an upcoming JS prototype
I actually meant "the buffer supplied as an input to the function" but I see how that is not at all clear :) |
Some callers (LibJS) will want to control the size of the output buffer, to decode up to a maximum length. They will also want to receive partial results in the case of an error. This patch adds a method to provide those capabilities, and makes the existing implementation use it.
In pure JS, we would have to implement a full UTF-8 encoder, so let's add a helper method to do the work in C++.
Note that we can currently only use simdutf for Base64 decoding if the provided stopBeforePartial option is loose, which is the default. There is an open issue for simdutf to implement strict and stop-before-partial options. Until then, for those options, we implement a slow decoder that is written exactly as the spec steps dictate. See: simdutf/simdutf#440
trflynn89
force-pushed
the
js_ta_base64
branch
from
September 3, 2024 14:12
d3cb0ab
to
955ce10
Compare
10 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
test262 diff (we pass all of the
Uint8Array
tests):