flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Nistix
Found beautiful solution!
Code: ; Input ; eax dword for print ; rdi buffer PrintToBufferDwordHex: push rdx mov edx,eax rept 8 n:0 { rol eax,4 mov dl,al and dl,00Fh cmp dl,00Ah jb @f add dl,7 @@: add dl,'0' mov [rdi+n],dl } pop rdx ret |
|||
![]() |
|
DimonSoft
Nistix wrote: Found beautiful solution! Why not just use plain assembler loops? 8 times more code might in most cases be worse than a small loop. |
|||
![]() |
|
Nistix
DimonSoft wrote:
Yes, you are right. I had make this optimized code: Code: ; Input ; eax dword for print ; rdi buffer PrintToBufferHexDWord: push rcx rdx mov ecx,8 align 16 .char: shl rdx,8 mov dl,al and dl,00Fh cmp dl,00Ah jb @f add dl,'A'-'9'-1 ; 7 @@: add dl,'0' ror eax,4 loop .char mov [rdi],rdx pop rdx rcx ret It works fine ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.