Slight speedup in itoa
This commit is contained in:
parent
d45f882710
commit
ffface8b0a
@ -1,13 +1,7 @@
|
||||
;; rax contains the integer
|
||||
;; rbx contains a pointer to the string buffer
|
||||
itoa:
|
||||
;; Fill 6 digits with zeroes
|
||||
mov byte [rbx], '0'
|
||||
mov byte [rbx + 1], '0'
|
||||
mov byte [rbx + 2], '0'
|
||||
mov byte [rbx + 3], '0'
|
||||
mov byte [rbx + 4], '0'
|
||||
mov byte [rbx + 5], '0'
|
||||
|
||||
;; Special case for the number '0'
|
||||
cmp rax, 0
|
||||
@ -16,6 +10,13 @@ itoa:
|
||||
ret
|
||||
|
||||
.not_zero:
|
||||
;; Fill 6 digits with zeroes
|
||||
mov byte [rbx + 1], '0'
|
||||
mov byte [rbx + 2], '0'
|
||||
mov byte [rbx + 3], '0'
|
||||
mov byte [rbx + 4], '0'
|
||||
mov byte [rbx + 5], '0'
|
||||
|
||||
sub rax, 100000
|
||||
inc byte [rbx]
|
||||
cmp rax, 0
|
||||
|
Loading…
Reference in New Issue
Block a user