-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlen.s
40 lines (31 loc) · 1.13 KB
/
ft_strlen.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# **************************************************************************** #
# #
# ::: :::::::: #
# ft_strlen.s :+: :+: :+: #
# +:+ +:+ +:+ #
# By: alaulom <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/01/11 12:48:23 by alaulom #+# #+# #
# Updated: 2016/02/20 14:42:15 by alaulom ### ########.fr #
# #
# **************************************************************************** #
;size_t ft_strlen(const char *s);
global _ft_strlen
section .text
_ft_strlen:
cmp rdi, 0
je _null
_count:
cmp rdi, 0
je _ret
mov rax, 0
mov rcx, -1
cld
repnz scasb
not rcx
lea rax, [rcx - 1]
_ret:
ret
_null:
mov rax, 0
ret