repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* bcmp.c, setenv.c: Use "nonzero" instead of "non-zero".
[official-gcc.git]
/
libiberty
/
ffs.c
blob
8ffb03e7c5e2ab762e43797c4a3a36057b28b770
1
/* ffs -- Find the first bit set in the parameter
2
3
NAME
4
ffs -- Find the first bit set in the parameter
5
6
SYNOPSIS
7
int ffs (int valu)
8
9
DESCRIPTION
10
Find the first bit set in the parameter. Bits are numbered from
11
right to left, starting with bit 1.
12
13
*/
14
15
int
16
ffs
(
valu
)
17
register
int
valu
;
18
{
19
register
int
bit
;
20
21
if
(
valu
==
0
)
22
return
0
;
23
24
for
(
bit
=
1
; !(
valu
&
1
);
bit
++)
25
valu
>>=
1
;
26
27
return
bit
;
28
}
29