We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fae19a0 commit fae1832Copy full SHA for fae1832
count.asm
@@ -57,7 +57,12 @@ _start: ; argc is at `rsp`, argv is at `rsp + 8`
57
from_decimal_loop:
58
movzx rdx, byte [rdi + rcx]
59
sub rdx, '0'
60
- imul rax, rax, 10
+
61
+ mov rbx, rax
62
+ shl rax, 3
63
+ shl rbx, 1
64
+ add rax, rbx
65
66
add rax, rdx
67
inc rcx
68
cmp byte [rdi + rcx], 0
@@ -85,7 +90,7 @@ to_decimal_loop:
85
90
86
91
write: ; args: `rax` syscall, `rdi` fd, `rsi` buf, `rdx` length
87
92
mov rax, 1
88
- mov rdi, 1
93
+ mov rdi, rax
89
94
lea rdx, [output+11]
95
sub rdx, rsi
96
syscall
0 commit comments