1BITMAP_POS_TO_ORD(9)    Basic Kernel Library Functions    BITMAP_POS_TO_ORD(9)
2
3
4

NAME

6       bitmap_pos_to_ord - find ordinal of set bit at given position in bitmap
7

SYNOPSIS

9       int bitmap_pos_to_ord(const unsigned long * buf, int pos, int bits);
10

ARGUMENTS

12       buf
13           pointer to a bitmap
14
15       pos
16           a bit position in buf (0 <= pos < bits)
17
18       bits
19           number of valid bit positions in buf
20

DESCRIPTION

22       Map the bit at position pos in buf (of length bits) to the ordinal of
23       which set bit it is. If it is not set or if pos is not a valid bit
24       position, map to -1.
25
26       If for example, just bits 4 through 7 are set in buf, then pos values 4
27       through 7 will get mapped to 0 through 3, respectively, and other pos
28       values will get mapped to 0. When pos value 7 gets mapped to (returns)
29       ord value 3 in this example, that means that bit 7 is the 3rd (starting
30       with 0th) set bit in buf.
31
32       The bit positions 0 through bits are valid positions in buf.
33
35Kernel Hackers Manual 3.10         June 2019              BITMAP_POS_TO_ORD(9)
Impressum