最初コミット
This commit is contained in:
33
u64todec.s
Normal file
33
u64todec.s
Normal file
@@ -0,0 +1,33 @@
|
||||
section .text
|
||||
|
||||
u64_to_dec:
|
||||
mov rcx, 10
|
||||
mov r8, rdi
|
||||
lea rdi, [rdi + 0x13]
|
||||
|
||||
test rax, rax
|
||||
jnz .convert
|
||||
mov byte [rdi], '0'
|
||||
dec rdi
|
||||
jmp .pad
|
||||
|
||||
.convert:
|
||||
xor rdx, rdx
|
||||
div rcx
|
||||
add dl, '0'
|
||||
mov [rdi], dl
|
||||
dec rdi
|
||||
test rax, rax
|
||||
jnz .convert
|
||||
|
||||
.pad:
|
||||
inc rdi
|
||||
.pad_loop:
|
||||
cmp rdi, r8
|
||||
jbe .done
|
||||
mov byte [rdi], ' '
|
||||
inc rdi
|
||||
jb .pad_loop
|
||||
|
||||
.done:
|
||||
ret
|
||||
Reference in New Issue
Block a user