-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strlen.s
More file actions
26 lines (21 loc) · 1.14 KB
/
ft_strlen.s
File metadata and controls
26 lines (21 loc) · 1.14 KB
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
; **************************************************************************** ;
; ;
; ::: :::::::: ;
; ft_strlen.s :+: :+: :+: ;
; +:+ +:+ +:+ ;
; By: lrocca <marvin@42.fr> +;+ +:+ +;+ ;
; +;+;+;+;+;+ +;+ ;
; Created: 2021/04/02 16:48:39 by lrocca ;+; ;+; ;
; Updated: 2021/04/02 16:48:45 by lrocca ;;; ;;;;;;;;.fr ;
; ;
; **************************************************************************** ;
section .text
global _ft_strlen
; size_t ft_strlen(const char *rdi);
_ft_strlen:
mov rax, -1 ; start index from -1
_loop:
inc rax ; increment index
cmp byte [rdi + rax], 0 ; compare *(s + index)
jnz _loop ; if not zero, loop
ret ; return index