57 lines
973 B
ArmAsm
57 lines
973 B
ArmAsm
|
.file "convert.c"
|
||
|
.text
|
||
|
.p2align 4,,15
|
||
|
.globl utoa
|
||
|
.type utoa, @function
|
||
|
utoa:
|
||
|
.LFB2:
|
||
|
.cfi_startproc
|
||
|
movl %edx, %r8d
|
||
|
leal -2(%rdx), %edx
|
||
|
movl %edi, %eax
|
||
|
cmpl $34, %edx
|
||
|
ja .L2
|
||
|
testl %edi, %edi
|
||
|
jne .L5
|
||
|
leaq 1(%rsi), %rcx
|
||
|
movb $48, (%rsi)
|
||
|
.L4:
|
||
|
movb $0, (%rcx)
|
||
|
movq %rsi, %rdi
|
||
|
movabsq $reverse, %rax
|
||
|
jmp *%rax
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L5:
|
||
|
movq %rsi, %rcx
|
||
|
movabsq $digits, %r9
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L3:
|
||
|
xorl %edx, %edx
|
||
|
addq $1, %rcx
|
||
|
divl %r8d
|
||
|
movl %edx, %edx
|
||
|
testl %eax, %eax
|
||
|
movzbl (%r9,%rdx), %edx
|
||
|
movb %dl, -1(%rcx)
|
||
|
jne .L3
|
||
|
jmp .L4
|
||
|
.p2align 4,,10
|
||
|
.p2align 3
|
||
|
.L2:
|
||
|
xorl %eax, %eax
|
||
|
ret
|
||
|
.cfi_endproc
|
||
|
.LFE2:
|
||
|
.size utoa, .-utoa
|
||
|
.section .rodata
|
||
|
.align 32
|
||
|
.type digits, @object
|
||
|
.size digits, 36
|
||
|
digits:
|
||
|
.byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43
|
||
|
.byte 0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50
|
||
|
.byte 0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a
|
||
|
.ident "GCC: (GNU) 7.3.0"
|