xref: /csrg-svn/lib/libc/mips/string/rindex.s (revision 52718)
1*52718Sbostic/*-
2*52718Sbostic * Copyright (c) 1991 The Regents of the University of California.
3*52718Sbostic * All rights reserved.
4*52718Sbostic *
5*52718Sbostic * This code is derived from software contributed to Berkeley by
6*52718Sbostic * Ralph Campbell.
7*52718Sbostic *
8*52718Sbostic * %sccs.include.redist.c%
9*52718Sbostic */
10*52718Sbostic
11*52718Sbostic#if defined(LIBC_SCCS) && !defined(lint)
12*52718Sbostic	ASMSTR("@(#)rindex.s	5.1 (Berkeley) 02/29/92")
13*52718Sbostic#endif /* LIBC_SCCS and not lint */
14*52718Sbostic
15*52718Sbostic#include "DEFS.h"
16*52718Sbostic
17*52718SbosticLEAF(rindex)
18*52718Sbostic	move	v0, zero		# default if not found
19*52718Sbostic1:
20*52718Sbostic	lbu	a3, 0(a0)		# get a byte
21*52718Sbostic	addu	a0, a0, 1
22*52718Sbostic	bne	a3, a1, 2f
23*52718Sbostic	subu	v0, a0, 1		# save address of last match
24*52718Sbostic2:
25*52718Sbostic	bne	a3, zero, 1b		# continue if not end
26*52718Sbostic	j	ra
27*52718SbosticEND(rindex)
28