Skip to content

Instantly share code, notes, and snippets.

@Unam3dd
Created May 30, 2023 16:33
Show Gist options
  • Save Unam3dd/00a71b1fb1497a9f1655f4e66c69a82d to your computer and use it in GitHub Desktop.
Save Unam3dd/00a71b1fb1497a9f1655f4e66c69a82d to your computer and use it in GitHub Desktop.
Assembly strlen slow
.intel_syntax noprefix
.global __vs_strlen_slow
.section .text
__vs_strlen_slow:
endbr64
test rdi, rdi
jz .L_ret_zero
cmp byte ptr [rdi], 0x0
jz .L_ret_zero
mov rax, rdi
.L_loop:
inc rax
cmp byte ptr [rax], 0x0
jnz .L_loop
sub rax, rdi
ret
.L_ret_zero:
xor rax, rax
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment