aboutsummaryrefslogtreecommitdiff
path: root/ft_strlen.s
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-23 02:54:37 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-23 02:54:37 +0100
commitb4b6364c2fc4b14a0aaac406891c3880243a9733 (patch)
treee204b7a7cefd18c764cfbf8adb7f1491b689352c /ft_strlen.s
parentc90117251f11e03452ae9808ff8626016c7958a1 (diff)
downloadlibasm-b4b6364c2fc4b14a0aaac406891c3880243a9733.tar.gz
libasm-b4b6364c2fc4b14a0aaac406891c3880243a9733.tar.bz2
libasm-b4b6364c2fc4b14a0aaac406891c3880243a9733.zip
refactored mandatory functions, to respect c calling convention
Diffstat (limited to 'ft_strlen.s')
-rw-r--r--ft_strlen.s13
1 files changed, 5 insertions, 8 deletions
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