Created
May 30, 2023 16:33
-
-
Save Unam3dd/00a71b1fb1497a9f1655f4e66c69a82d to your computer and use it in GitHub Desktop.
Assembly strlen slow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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