aboutsummaryrefslogtreecommitdiff
path: root/ft_strlen.s
blob: 82c0e346c8e73fe8c24b38cd30c6b84309507b08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
.globl	_ft_strlen

 _ft_strlen:
	mov rbx, rdi  # first argument in rbx
	xor rax, rax  # rax = 0
	FT_STRLEN_LOOP:
		cmp byte ptr [rbx + rax], 0  # compare rbx[rax] and '\0'
		je FT_STRLEN_RET
		inc rax
		jmp FT_STRLEN_LOOP
 	FT_STRLEN_RET:
 		ret