blob: 833cb4e75d620a4a21f26c953ffb9dcd69d589c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
; utils/parse.asm - decimal parsing helper.
section .text
; parse_u64: read decimal digits at [RSI] into RAX, advancing RSI past them.
; Stops on the first non-digit. Clobbers RAX, RDX.
parse_u64:
xor rax, rax
.digit:
mov dl, [rsi]
cmp dl, '0'
jl .done
cmp dl, '9'
jg .done
sub dl, '0'
movzx rdx, dl
imul rax, rax, 10
add rax, rdx
inc rsi
jmp .digit
.done:
ret
|