xref: /csrg-svn/lib/libc/hp300/string/ffs.s (revision 61123)
141811Sbostic/*-
2*61123Sbostic * Copyright (c) 1990, 1993
3*61123Sbostic *	The Regents of the University of California.  All rights reserved.
441811Sbostic *
541811Sbostic * This code is derived from software contributed to Berkeley by
641811Sbostic * the Systems Programming Group of the University of Utah Computer
741811Sbostic * Science Department.
841811Sbostic *
941811Sbostic * %sccs.include.redist.c%
1041811Sbostic */
1141811Sbostic
1241811Sbostic#if defined(LIBC_SCCS) && !defined(lint)
13*61123Sbostic	.asciz "@(#)ffs.s	8.1 (Berkeley) 06/04/93"
1441811Sbostic#endif /* LIBC_SCCS and not lint */
1541811Sbostic
1641811Sbostic/* bit = ffs(value) */
1741811Sbostic
1841811Sbostic#include "DEFS.h"
1941811Sbostic
2041811SbosticENTRY(ffs)
2141811Sbostic	moveq	#-1,d0
2241811Sbostic	movl	sp@(4),d1
2341811Sbostic	beq	done
2441811Sbosticagain:
2541811Sbostic	addql	#1,d0
2641811Sbostic	btst	d0,d1
2741811Sbostic	beq	again
2841811Sbosticdone:
2941811Sbostic	addql	#1,d0
3041811Sbostic	rts
31