Ruby
2.7.2p137(2020-10-01revision5445e0435260b449decf2ac16f9d09bae3cafe72)
missing
ffs.c
Go to the documentation of this file.
1
/* ffs.c - find first set bit */
2
/* ffs() is defined by Single Unix Specification. */
3
4
#include "
ruby.h
"
5
6
int
ffs
(
int
arg
)
7
{
8
unsigned
int
x
= (
unsigned
int
)
arg
;
9
int
r;
10
11
if
(
x
== 0)
12
return
0;
13
14
r = 1;
15
16
#if 32 < SIZEOF_INT * CHAR_BIT
17
if
((
x
& 0xffffffff) == 0) {
18
x
>>= 32;
19
r += 32;
20
}
21
#endif
22
23
if
((
x
& 0xffff) == 0) {
24
x
>>= 16;
25
r += 16;
26
}
27
28
if
((
x
& 0xff) == 0) {
29
x
>>= 8;
30
r += 8;
31
}
32
33
if
((
x
& 0xf) == 0) {
34
x
>>= 4;
35
r += 4;
36
}
37
38
if
((
x
& 0x3) == 0) {
39
x
>>= 2;
40
r += 2;
41
}
42
43
if
((
x
& 0x1) == 0) {
44
x
>>= 1;
45
r += 1;
46
}
47
48
return
r;
49
}
int
__inline__ int
Definition:
rb_mjit_min_header-2.7.2.h:2845
ffs
int ffs(int arg)
Definition:
ffs.c:6
ruby.h
arg
VALUE arg
Definition:
rb_mjit_min_header-2.7.2.h:5597
Bigint::x
ULong x[1]
Definition:
dtoa.c:497
Generated by
1.8.20