xref: /csrg-svn/lib/libc/mips/string/rindex.s (revision 52737)
152718Sbostic/*-
252718Sbostic * Copyright (c) 1991 The Regents of the University of California.
352718Sbostic * All rights reserved.
452718Sbostic *
552718Sbostic * This code is derived from software contributed to Berkeley by
652718Sbostic * Ralph Campbell.
752718Sbostic *
852718Sbostic * %sccs.include.redist.c%
952718Sbostic */
1052718Sbostic
11*52737Sbostic#include "DEFS.h"
12*52737Sbostic
1352718Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*52737Sbostic	ASMSTR("@(#)rindex.s	5.2 (Berkeley) 02/29/92")
1552718Sbostic#endif /* LIBC_SCCS and not lint */
1652718Sbostic
1752718SbosticLEAF(rindex)
1852718Sbostic	move	v0, zero		# default if not found
1952718Sbostic1:
2052718Sbostic	lbu	a3, 0(a0)		# get a byte
2152718Sbostic	addu	a0, a0, 1
2252718Sbostic	bne	a3, a1, 2f
2352718Sbostic	subu	v0, a0, 1		# save address of last match
2452718Sbostic2:
2552718Sbostic	bne	a3, zero, 1b		# continue if not end
2652718Sbostic	j	ra
2752718SbosticEND(rindex)
28