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