「🏗️」 wip(str*): working on them, strcmp doesn't work the rest does i think
This commit is contained in:
32
src/str/ft_strcmp.s
Normal file
32
src/str/ft_strcmp.s
Normal file
@@ -0,0 +1,32 @@
|
||||
section .text
|
||||
global ft_strcmp
|
||||
|
||||
; int ft_strcmp(const char *s1, const char *s2)
|
||||
ft_strcmp:
|
||||
mov rax, 0
|
||||
cmp rdi, 0
|
||||
je .ret
|
||||
cmp rsi, 0
|
||||
je .ret
|
||||
|
||||
.loop:
|
||||
|
||||
mov r10b, BYTE [rdi]
|
||||
cmp r10b, BYTE [rsi]
|
||||
je .end
|
||||
|
||||
cmp BYTE [rdi], 0
|
||||
je .end
|
||||
cmp BYTE [rsi], 0
|
||||
je .end
|
||||
|
||||
inc rsi
|
||||
inc rdi
|
||||
jmp .loop
|
||||
|
||||
.end:
|
||||
mov al, BYTE [rsi]
|
||||
mov r10b, BYTE [rdi]
|
||||
sub rax, r10
|
||||
.ret:
|
||||
ret
|
||||
Reference in New Issue
Block a user