-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlen.s
29 lines (26 loc) · 1.17 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
; **************************************************************************** ;
; ;
; ::: :::::::: ;
; ft_strlen.s :+: :+: :+: ;
; +:+ +:+ +:+ ;
; By: cacharle <marvin@42.fr> +;+ +:+ +;+ ;
; +;+;+;+;+;+ +;+ ;
; Created: 2019/11/22 03:04:20 by cacharle ;+; ;+; ;
; Updated: 2019/11/23 00:17:47 by cacharle ;;; ;;;;;;;;.fr ;
; ;
; **************************************************************************** ;
%ifdef __LINUX__
%define M_FT_STRLEN ft_strlen
%else
%define M_FT_STRLEN _ft_strlen
%endif
global M_FT_STRLEN
section .text
; int ft_strlen(char *);
M_FT_STRLEN:
mov eax, -1
FT_STRLEN_LOOP:
inc eax
cmp byte [rdi + rax], 0 ; compare rbx[rax] and '\0'
jne FT_STRLEN_LOOP
ret