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.2Sjakllsch RCSID("$NetBSD: ffs.S,v 1.2 2014/03/22 19:38:46 jakllsch 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 211.2SjakllschEND(ffs) 22