ffs.S revision 1.1
11.1Schristos/* 21.1Schristos * Written by J.T. Conklin <jtc@NetBSD.org>. 31.1Schristos * Public domain. 41.1Schristos */ 51.1Schristos 61.1Schristos#include <machine/asm.h> 71.1Schristos 81.1Schristos#if defined(LIBC_SCCS) 91.1Schristos RCSID("$NetBSD: ffs.S,v 1.1 2005/12/20 19:28:49 christos Exp $") 101.1Schristos#endif 111.1Schristos 121.1SchristosENTRY(ffs) 131.1Schristos bsfl 4(%esp),%eax 141.1Schristos jz L1 /* ZF is set if all bits are 0 */ 151.1Schristos incl %eax /* bits numbered from 1, not 0 */ 161.1Schristos ret 171.1Schristos 181.1Schristos _ALIGN_TEXT 191.1SchristosL1: xorl %eax,%eax /* clear result */ 201.1Schristos ret 21