xref: /csrg-svn/lib/libc/mips/string/index.s (revision 52737)
152717Sbostic/*-
252717Sbostic * Copyright (c) 1991 The Regents of the University of California.
352717Sbostic * 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
11*52737Sbostic#include "DEFS.h"
12*52737Sbostic
1352717Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*52737Sbostic	ASMSTR("@(#)index.s	5.2 (Berkeley) 02/29/92")
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