NetBSD/lib/libc/arch/i386/string/rindex.S

33 lines
498 B
ArmAsm
Raw Normal View History

/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
1994-03-12 04:39:55 +03:00
#include <machine/asm.h>
#if defined(LIBC_SCCS)
1995-04-29 02:57:54 +04:00
RCSID("$NetBSD: rindex.S,v 1.9 1995/04/28 22:58:07 jtc Exp $")
#endif
1993-12-09 01:10:14 +03:00
#ifdef STRRCHR
ENTRY(strrchr)
#else
ENTRY(rindex)
1993-12-09 01:10:14 +03:00
#endif
pushl %ebx
movl 8(%esp),%edx
movb 12(%esp),%cl
xorl %eax,%eax /* init pointer to null */
.align 2,0x90
L1:
movb (%edx),%bl
cmpb %bl,%cl
jne L2
movl %edx,%eax
L2:
incl %edx
testb %bl,%bl /* null terminator??? */
jnz L1
popl %ebx
ret