Thanks to visit codestin.com
Credit goes to github.com

Skip to content

aarch64 base64decode: replace TBL+RHADD with CLZ for delta_hash #783

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tantei3
Copy link
Contributor

@tantei3 tantei3 commented May 4, 2025

For regular and URL decode, I observed that while computing res = lo & hi, we currently mapped 0 to error, 1 to space and we still have 7 bits available.
So now the tables are updated to map:
lowercase alphabets to 0x80 and 0x40
uppercase alphabets to 0x20 and 0x10
numbers to 0x8
/ (- in URL) to 0x4
+ (_ in URL) to 0x2

With this scheme and ensuring that the value of lo & hi have only 1 bit set, we don't need to use vrhaddq_u8(vqtbl1q_u8(delta_asso, lo_nibbles0), hi_bits0); to map it to indices and we can simply use CLZ to map these res bits to continuous range 0 to 7 which should save us 1 instruction. Now the offset to add can be placed in accordance with the result of the CLZ output for regular and URL decoding.

For Hybrid decoding unfortunately I couldn't get this scheme to work as it needed 4 bits for + _ - / with each having different offsets and 2 bits for numbers + spaces left only 2 bits for letters which in the current scheme have collision and need at least 3 bits to classify.

@tantei3 tantei3 marked this pull request as ready for review May 4, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant