1ddi_ffs(9F) Kernel Functions for Drivers ddi_ffs(9F)
2
3
4
6 ddi_ffs, ddi_fls - find first (last) bit set in a long integer
7
9 #include <sys/conf.h>
10 #include <sys/ddi.h>
11 #include <sys/sunddi.h>
12
13
14
15 intddi_ffs(long mask);
16
17
18 int ddi_fls(long mask);
19
20
22 Solaris DDI specific (Solaris DDI).
23
25 mask A 32-bit argument value to search through.
26
27
29 The function ddi_ffs() takes its argument and returns the shift count
30 that the first (least significant) bit set in the argument corresponds
31 to. The function ddi_fls() does the same, only it returns the shift
32 count for the last (most significant) bit set in the argument.
33
35 0 No bits are set in mask.
36
37
38 N Bit N is the least significant (ddi_ffs) or most significant
39 (ddi_fls) bit set in mask. Bits are numbered from 1 to 32, with
40 bit 1 being the least significant bit position and bit 32 the most
41 significant position.
42
43
45 This function can be called from user, interrupt, or kernel context.
46
48 Writing Device Drivers
49
50
51
52SunOS 5.11 16 Jan 2006 ddi_ffs(9F)