-
-
Save stepantubanov/1867a3662ba1098a42cf5837870c662c to your computer and use it in GitHub Desktop.
arm64 binary to hex
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
// Suggestion for https://codereview.stackexchange.com/questions/256828/binary-to-hex-in-arm64-simd-assembly | |
rev x1, x1 | |
# x1 = low nibble | |
# x2 = high nibble | |
and x2, x1, #0xf0f0f0f0f0f0f0f0 | |
lsr x2, x2, #4 | |
and x1, x1, #0x0f0f0f0f0f0f0f0f | |
fmov d0, x1 | |
fmov d1, x2 | |
// Interleave | |
zip1 v0.16b, v1.16b, v0.16b | |
ldr q1, hex_table | |
tbl v0.16b, { v1.16b }, v0.16b | |
st1 { v0.16b }, [x0] | |
strb wzr, [x0, #16] | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment