aboutsummaryrefslogtreecommitdiff
path: root/S/str_rchr.S
diff options
context:
space:
mode:
authorKlaatu <[email protected]>2015-05-17 15:33:21 +1200
committerKlaatu <[email protected]>2015-05-17 15:33:21 +1200
commitb0de699679e8f1e39af847ed172d1ba605b4370c (patch)
tree01dac00471d61f727394e508c613b29cff0ceae5 /S/str_rchr.S
bulk upload of source
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