xref: /csrg-svn/lib/libc/mips/string/index.s (revision 61146)
152717Sbostic/*-
2*61146Sbostic * Copyright (c) 1991, 1993
3*61146Sbostic *	The Regents of the University of California.  All rights reserved.
452717Sbostic *
552717Sbostic * This code is derived from software contributed to Berkeley by
652717Sbostic * Ralph Campbell.
752717Sbostic *
852717Sbostic * %sccs.include.redist.c%
952717Sbostic */
1052717Sbostic
1155708Sralph#include <machine/machAsmDefs.h>
1252737Sbostic
1352717Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*61146Sbostic	ASMSTR("@(#)index.s	8.1 (Berkeley) 06/04/93")
1552717Sbostic#endif /* LIBC_SCCS and not lint */
1652717Sbostic
1752717SbosticLEAF(index)
1852717Sbostic	lbu	a2, 0(a0)		# get a byte
1952717Sbostic	addu	a0, a0, 1
2052717Sbostic	beq	a2, a1, fnd
2152717Sbostic	bne	a2, zero, index
2252717Sbosticnotfnd:
2352717Sbostic	move	v0, zero
2452717Sbostic	j	ra
2552717Sbosticfnd:
2652717Sbostic	subu	v0, a0, 1
2752717Sbostic	j	ra
2852717SbosticEND(index)
29