source:
trunk/minix/lib/other/ffs.c@
15
Last change on this file since 15 was 9, checked in by , 14 years ago | |
---|---|
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 | |
8 | int ffs(word) |
9 | int 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.