Created
November 1, 2018 05:20
-
-
Save remexre/6541a8757d30c1c206066e44c9f9884c to your computer and use it in GitHub Desktop.
Miscellaneous assembly snippets
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
bits 64 | |
global dehex | |
[section .text] | |
; unsigned char dehex(const char hex[2]); | |
dehex: | |
mov ax, [rdi] | |
sub ax, 12336 | |
cmp ax, 2559 | |
jl .L1 | |
sub ax, 1792 | |
.L1: | |
cmp al, 9 | |
jle .L2 | |
sub al, 7 | |
.L2: | |
xchg ah, al | |
shl ah, 4 | |
or al, ah | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment