From b4b6364c2fc4b14a0aaac406891c3880243a9733 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 23 Nov 2019 02:54:37 +0100 Subject: refactored mandatory functions, to respect c calling convention --- ft_strlen.s | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'ft_strlen.s') diff --git a/ft_strlen.s b/ft_strlen.s index 319a321..41372eb 100644 --- a/ft_strlen.s +++ b/ft_strlen.s @@ -14,12 +14,9 @@ global _ft_strlen ; int ft_strlen(char *); _ft_strlen: - mov rbx, rdi ; str argument - xor rax, rax + mov eax, -1 FT_STRLEN_LOOP: - cmp byte [rbx + rax], 0 ; compare rbx[rax] and '\0' - je FT_STRLEN_RET - inc rax - jmp FT_STRLEN_LOOP - FT_STRLEN_RET: - ret + inc eax + cmp byte [rdi + rax], 0 ; compare rbx[rax] and '\0' + jne FT_STRLEN_LOOP + ret -- cgit