1 /*
2  * Copyright (c) 1994 William F. Jolitz.
3  * 386BSD Copyright Restrictions Apply. All Other Rights Reserved.
4  *
5  * $Id: ffs.h,v 1.1 94/06/09 18:19:56 bill Exp Locker: bill $
6  * BSD find first set bit.
7  */
8 
9 __INLINE int
ffs(int bits)10 ffs(int bits) {
11 	int rv;
12 
13 	asm volatile ("bsfl %1, %0 ; je 1f" :  "=r" (rv) : "m" (bits));
14 	return (rv + 1);
15 
16 	asm ("1:");
17 	return (0);
18 }
19