1BITMAP_REMAP(9) Basic Kernel Library Functions BITMAP_REMAP(9)
2
3
4
6 bitmap_remap - Apply map defined by a pair of bitmaps to another bitmap
7
9 void bitmap_remap(unsigned long * dst, const unsigned long * src,
10 const unsigned long * old, const unsigned long * new,
11 int bits);
12
14 dst
15 remapped result
16
17 src
18 subset to be remapped
19
20 old
21 defines domain of map
22
23 new
24 defines range of map
25
26 bits
27 number of bits in each of these bitmaps
28
30 Let old and new define a mapping of bit positions, such that whatever
31 position is held by the n-th set bit in old is mapped to the n-th set
32 bit in new. In the more general case, allowing for the possibility that
33 the weight 'w' of new is less than the weight of old, map the position
34 of the n-th set bit in old to the position of the m-th set bit in new,
35 where m == n % w.
36
37 If either of the old and new bitmaps are empty, or if src and dst point
38 to the same location, then this routine copies src to dst.
39
40 The positions of unset bits in old are mapped to themselves (the
41 identify map).
42
43 Apply the above specified mapping to src, placing the result in dst,
44 clearing any bits previously set in dst.
45
46 For example, lets say that old has bits 4 through 7 set, and new has
47 bits 12 through 15 set. This defines the mapping of bit position 4 to
48 12, 5 to 13, 6 to 14 and 7 to 15, and of all other bit positions
49 unchanged. So if say src comes into this routine with bits 1, 5 and 7
50 set, then dst should leave with bits 1, 13 and 15 set.
51
53Kernel Hackers Manual 3.10 June 2019 BITMAP_REMAP(9)