From a1010618a24474e4c8253d2fc1df300474bac609 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 2 Dec 2016 04:58:57 -0500 Subject: Add 32-bit hex formatting --- lib.asm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib.asm (limited to 'lib.asm') diff --git a/lib.asm b/lib.asm new file mode 100644 index 0000000..10d0e1c --- /dev/null +++ b/lib.asm @@ -0,0 +1,19 @@ +section .rodata +hexDigits: db '0123456789ABCDEF' + +section .text +hex32: + push rbx + mov rbx, hexDigits + xor rax, rax + +%rep 8 + shl rax, 8 + mov al, dil + and al, 0x0F + xlatb + shr rdi, 4 +%endrep + + pop rbx +ret -- cgit 1.4.1