1993-10-07 03:17:24 +03:00
|
|
|
/*
|
1995-04-29 02:53:59 +04:00
|
|
|
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
|
|
* Public domain.
|
1993-10-07 03:17:24 +03:00
|
|
|
*/
|
|
|
|
|
1994-03-12 04:39:55 +03:00
|
|
|
#include <machine/asm.h>
|
|
|
|
|
1993-10-21 04:39:55 +03:00
|
|
|
#if defined(LIBC_SCCS)
|
1995-04-29 02:57:54 +04:00
|
|
|
RCSID("$NetBSD: ffs.S,v 1.7 1995/04/28 22:58:00 jtc Exp $")
|
1993-10-21 04:39:55 +03:00
|
|
|
#endif
|
1993-10-07 03:17:24 +03:00
|
|
|
|
|
|
|
ENTRY(ffs)
|
|
|
|
bsfl 4(%esp),%eax
|
|
|
|
jz L1 /* ZF is set if all bits are 0 */
|
|
|
|
incl %eax /* bits numbered from 1, not 0 */
|
|
|
|
ret
|
|
|
|
|
|
|
|
.align 2
|
|
|
|
L1: xorl %eax,%eax /* clear result */
|
|
|
|
ret
|