aboutsummaryrefslogtreecommitdiff
path: root/ft_strlen.s
blob: b0f84e7e95c9c3eae3c80bd4d26ea7f7d410060c (plain)
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