fix(strcmp): set rax and rbx to 0 before cmp
This commit is contained in:
parent
62e5d095b6
commit
83d43c88fc
|
@ -1,19 +1,20 @@
|
||||||
global ft_strcmp
|
global ft_strcmp
|
||||||
|
|
||||||
ft_strcmp:
|
ft_strcmp:
|
||||||
xor rdx, rdx
|
xor rdx, rdx
|
||||||
xor rax, rax
|
xor rax, rax
|
||||||
.loop:
|
.loop:
|
||||||
mov al, [rsi + rdx]
|
mov al, [rsi + rdx]
|
||||||
cmp byte [rdi + rdx], al
|
cmp byte [rdi + rdx], al
|
||||||
jne .done
|
jne .done
|
||||||
cmp byte [rdi + rdx], 0
|
cmp byte [rdi + rdx], 0
|
||||||
je .done
|
je .done
|
||||||
inc rdx
|
inc rdx
|
||||||
jmp .loop
|
jmp .loop
|
||||||
.done:
|
.done:
|
||||||
|
xor rax, rax
|
||||||
|
xor rbx, rbx
|
||||||
mov al, byte [rdi + rdx]
|
mov al, byte [rdi + rdx]
|
||||||
mov bl, byte [rsi + rdx]
|
mov bl, byte [rsi + rdx]
|
||||||
sub rax, rbx
|
sub rax, rbx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue