42_libasm/ft_strlen.asm

13 lines
206 B
NASM
Raw Normal View History

2024-08-07 11:42:16 -04:00
section .text
global ft_strlen
ft_strlen:
2024-08-28 07:53:42 -04:00
mov rcx, 0
2024-08-07 11:42:16 -04:00
loop:
2024-08-28 07:53:42 -04:00
cmp BYTE [rdi + rcx], 0
2024-08-07 11:42:16 -04:00
je out
2024-08-28 07:53:42 -04:00
inc rcx
2024-08-07 11:42:16 -04:00
jmp loop
out:
2024-08-28 07:53:42 -04:00
mov rax, rcx
2024-08-07 11:42:16 -04:00
ret