xref: /csrg-svn/lib/libc/mips/string/strlen.s (revision 52720)
1*52720Sbostic/*-
2*52720Sbostic * Copyright (c) 1991 The Regents of the University of California.
3*52720Sbostic * All rights reserved.
4*52720Sbostic *
5*52720Sbostic * This code is derived from software contributed to Berkeley by
6*52720Sbostic * Ralph Campbell.
7*52720Sbostic *
8*52720Sbostic * %sccs.include.redist.c%
9*52720Sbostic */
10*52720Sbostic
11*52720Sbostic#if defined(LIBC_SCCS) && !defined(lint)
12*52720Sbostic	ASMSTR("@(#)strlen.s	5.1 (Berkeley) 02/29/92")
13*52720Sbostic#endif /* LIBC_SCCS and not lint */
14*52720Sbostic
15*52720Sbostic#include "DEFS.h"
16*52720Sbostic
17*52720SbosticLEAF(strlen)
18*52720Sbostic	addu	v1, a0, 1
19*52720Sbostic1:
20*52720Sbostic	lb	v0, 0(a0)		# get byte from string
21*52720Sbostic	addu	a0, a0, 1		# increment pointer
22*52720Sbostic	bne	v0, zero, 1b		# continue if not end
23*52720Sbostic	subu	v0, a0, v1		# compute length - 1 for '\0' char
24*52720Sbostic	j	ra
25*52720SbosticEND(strlen)
26