1 DDI_FFS(9F) Kernel Functions for Drivers DDI_FFS(9F)
2
3
4
5 NAME
6 ddi_ffs, ddi_fls - find first (last) bit set in a long integer
7
8 SYNOPSIS
9 #include <sys/conf.h>
10 #include <sys/ddi.h>
11 #include <sys/sunddi.h>
12
13
14
15 int ddi_ffs(long mask);
16
17
18 int ddi_fls(long mask);
19
20
21 INTERFACE LEVEL
22 Solaris DDI specific (Solaris DDI).
23
24 PARAMETERS
25 mask
26 A 32-bit argument value to search through.
27
28
29 DESCRIPTION
30 The function ddi_ffs() takes its argument and returns the shift count
31 that the first (least significant) bit set in the argument corresponds
32 to. The function ddi_fls() does the same, only it returns the shift
33 count for the last (most significant) bit set in the argument.
34
35 RETURN VALUES
36 0
37 No bits are set in mask.
38
39
40 N
41 Bit N is the least significant (ddi_ffs) or most significant
42 (ddi_fls) bit set in mask. Bits are numbered from 1 to 32, with
43 bit 1 being the least significant bit position and bit 32 the most
44 significant position.
45
46
47 CONTEXT
48 This function can be called from user, interrupt, or kernel context.
49
50 SEE ALSO
51 Writing Device Drivers
52
53
54
55 June 5, 2013 DDI_FFS(9F)
|
1 DDI_FFS(9F) Kernel Functions for Drivers DDI_FFS(9F)
2
3 NAME
4 ddi_ffs, ddi_ffsll, ddi_fls, ddi_flsll - find first (last) bit set in a
5 long (long) integer
6
7 SYNOPSIS
8 #include <sys/conf.h>
9 #include <sys/ddi.h>
10 #include <sys/sunddi.h>
11
12 int
13 ddi_ffs(long mask);
14
15 int
16 ddi_fls(long mask);
17
18 int
19 ddi_ffs(long long mask);
20
21 int
22 ddi_fls(long long mask);
23
24 INTERFACE LEVEL
25 Solaris DDI specific (Solaris DDI).
26
27 PARAMETERS
28 mask A 32-bit or 64-bit argument value to search through.
29
30 DESCRIPTION
31 The functions ddi_ffs() and ddi_ffsll() take their argument and return
32 the shift count that the first (least significant) bit set in the
33 argument corresponds to. The functions ddi_fls() and ddi_flsll() do the
34 same, only they returns the shift count for the last (most significant)
35 bit set in the argument. ddi_ffs() and ddi_fls() operate on 32-bit
36 values, while ddi_ffsll() and ddi_flsll() operate on 64-bit values.
37
38 CONTEXT
39 These functions can be called from user, interrupt, or kernel context.
40
41 RETURN VALUES
42 0 No bits are set in mask.
43
44 N Bit N is the least significant (ddi_ffs(), ddi_ffsll()) or
45 most significant (ddi_fls(), ddi_flsll()) bit set in mask.
46 Bits are numbered from 1 to 32 or 64, with bit 1 being the
47 least significant bit position and bit 32 or 64 the most
48 significant position, depending on the variant of the
49 functions used.
50
51 SEE ALSO
52 Writing Device Drivers
53
54 illumos July 14, 2017 illumos
|