aboutsummaryrefslogtreecommitdiffstats
path: root/src/u_strlen.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/u_strlen.S')
-rw-r--r--src/u_strlen.S16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/u_strlen.S b/src/u_strlen.S
new file mode 100644
index 0000000..27d9663
--- /dev/null
+++ b/src/u_strlen.S
@@ -0,0 +1,16 @@
+.text
+.globl u_strlen
+
+u_strlen:
+ movq %rdi, %rcx
+
+u_loop:
+ cmpb $0x0, (%rcx)
+ je u_ret
+ inc %rcx
+ jmp u_loop
+
+u_ret:
+ sub %rdi, %rcx
+ movq %rcx, %rax
+ retq