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