aboutsummaryrefslogtreecommitdiff
path: root/S/str_rchr.S
diff options
context:
space:
mode:
Diffstat (limited to 'S/str_rchr.S')
-rw-r--r--S/str_rchr.S24
1 files changed, 24 insertions, 0 deletions
diff --git a/S/str_rchr.S b/S/str_rchr.S
new file mode 100644
index 0000000..032c393
--- /dev/null
+++ b/S/str_rchr.S
@@ -0,0 +1,24 @@
+.globl str_rchr
+.type str_rchr, @function
+str_rchr:
+ pushl %esi
+ movl 8(%esp), %esi
+ movb 12(%esp), %ah
+ xorl %ecx, %ecx
+.L1:
+ lodsb
+ cmpb %ah,%al
+ jne .L0
+ movl %esi, %ecx
+.L0:
+ testb %al,%al
+ jne .L1
+
+ testl %ecx, %ecx
+ jnz .L3
+ movl %esi, %ecx
+.L3:
+ subl 8(%esp), %ecx
+ leal -1(%ecx), %eax
+ popl %esi
+ ret