-
Notifications
You must be signed in to change notification settings - Fork 132
Base64 part2 : base64url, UTF-8 inputs and base64_to_binary_safe #382
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
3a64443
trimming some unnecessary code
lemire 3f9cb0f
fixing missing rvv implementation
lemire a9ea1c6
completing the base64 implementation.
lemire 0f49240
adding ppc64
lemire 5daa520
saving
151aa09
saturated.
lemire b917aa8
finishing...
ca17560
various fixes
94b7dac
Implemented bun benchmark
lemire c35d8df
Obvious fix.
lemire 1a90f2a
documentation
lemire bd454ea
adding libbase64 competitor
lemire bdab72f
more documentation.
lemire 65f933b
base64url (first steps)
lemire 4aa837d
working through
lemire 8dc79aa
implemented base64url for ARM.
lemire fe1138f
documentation.
lemire 5d1d0d5
prototype base64url
21717c4
solved based64url
c96ac90
completing the base64 implementation.
lemire 106e18c
adding ppc64
lemire d1c9cbc
saving
8606798
saturated.
lemire e7eae70
finishing...
9262b4b
various fixes
3444f4e
Implemented bun benchmark
lemire 6949b2c
Obvious fix.
lemire 381945b
documentation
lemire 7b304d3
adding libbase64 competitor
lemire f51ffdf
more documentation.
lemire 3d87826
base64url (first steps)
lemire c72079c
working through
lemire 200b6bc
implemented base64url for ARM.
lemire 4971bc2
documentation.
lemire c729247
prototype base64url
e32acc9
solved based64url
038ce51
Merge branch 'base64_part2' of github.com:simdutf/simdutf into base64…
9154818
fixing a missing func definition (bad signature)
lemire fd037f5
no such thing as version 4 of uraimo/run-on-arch-action
lemire 0de753a
fixes
lemire ccdf51d
Update benchmarks/base64/benchmark_base64.cpp
lemire 7ec70f2
Update benchmarks/base64/benchmark_base64.cpp
lemire 18dc616
Update benchmarks/base64/libbase64_spaces.h
lemire aeb2f5f
Update include/simdutf/implementation.h
lemire e0ce663
Update src/haswell/avx2_base64.cpp
lemire bb9d1fc
various minor fixes (linting + comments)
f511d9a
adding another comment.
e2a224f
cleaning up the base64 benchmark flags
5e6a366
disabling Ubuntu rvv VLEN=1024 (clang 17) CI due to system failures
9a92c54
adding the option
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
working through
- Loading branch information
commit 4aa837d44b1126a32badaa9fc7971afbe23c46a6
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | ||
| spaces=' \t\n\r' | ||
| lut_lo = [0x3a, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x61, 0xe1, 0xb4, 0xf4, 0xe5, 0xf4, 0xb4] | ||
| lut_hi = [0x11, 0x20, 0x42, 0x80, 0x8, 0x4, 0x8, 0x4, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20] | ||
| roll = [0x0, 0x10, 0x13, 0x4, 0xbf, 0xbf, 0xb9, 0xb9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | ||
| def decode(s): | ||
| low = s & 0xf | ||
| high = s >> 4 | ||
| m = lut_lo[low] & lut_hi[high] | ||
| if(m > 0x3): | ||
| return (m, None) | ||
| if s == 0x2f: | ||
| off = roll[high - 1] | ||
| else: | ||
| off = roll[high] | ||
| return (m,(s + off)&0xff) | ||
|
|
||
| for i in range(256): | ||
| m,d = decode(i) | ||
| if d is None: | ||
| assert t.find(chr(i)) == -1 | ||
| assert spaces.find(chr(i)) == -1 | ||
| continue | ||
| if m == 0: | ||
| assert d >= 0 | ||
| # we must have a base64 element | ||
| v = t.find(chr(i)) | ||
| #print(i, chr(i), v, d) | ||
| assert v == d | ||
| else: | ||
| # we must have a space | ||
| v = spaces.find(chr(i)) | ||
| assert v >= 0 |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
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.
We can remove the conditional and directly pass it to the template argument of the function. Removal of a branch is a good :-)
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.
There is indeed a runtime branch here, and it is not free, but pushing it down might not make disappear. A different option would be to have distinct functions for base64url and regular base64, but I thought it was not very nice from an API point of view.