source: trunk/minix/lib/other/ffs.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 243 bytes
Line 
1#include <lib.h>
2/* ffs(3)
3 *
4 * Author: Terrence W. Holm Sep. 1988
5 */
6_PROTOTYPE( int ffs, (int word));
7
8int ffs(word)
9int word;
10{
11 int i;
12
13 if (word == 0) return(0);
14
15 for (i = 1;; ++i, word >>= 1)
16 if (word & 1) return(i);
17}
Note: See TracBrowser for help on using the repository browser.