xref: /original-bsd/lib/libc/sparc/string/strlen.s (revision 13deef58)
1/*
2 * Copyright (c) 1992 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
8 *
9 * %sccs.include.redist.c%
10 *
11 * from: $Header: strlen.s,v 1.1 92/06/25 12:52:47 torek Exp $
12 */
13
14#if defined(LIBC_SCCS) && !defined(lint)
15	.asciz "@(#)strlen.s	5.1 (Berkeley) 06/25/92"
16#endif /* LIBC_SCCS and not lint */
17
18#include "DEFS.h"
19
20ENTRY(strlen)
21	add	%o0, 1, %o1	! save starting point + 1
221:
23	ldsb	[%o0], %o2	! fetch byte
24	tst	%o2		! null?
25	bne	1b		! no, keep going
26	inc	%o0		! always increment pointer
27	retl
28	sub	%o0, %o1, %o0	! return length (ptr - (origptr+1))
29