1 #include <linux/bitmap.h>
3 void __bitmap_set(unsigned long *map
, unsigned int start
, int len
)
5 unsigned long *p
= map
+ BIT_WORD(start
);
6 const unsigned int size
= start
+ len
;
7 int bits_to_set
= BITS_PER_LONG
- (start
% BITS_PER_LONG
);
8 unsigned long mask_to_set
= BITMAP_FIRST_WORD_MASK(start
);
10 while (len
- bits_to_set
>= 0) {
13 bits_to_set
= BITS_PER_LONG
;
18 mask_to_set
&= BITMAP_LAST_WORD_MASK(size
);
23 void __bitmap_clear(unsigned long *map
, unsigned int start
, int len
)
25 unsigned long *p
= map
+ BIT_WORD(start
);
26 const unsigned int size
= start
+ len
;
27 int bits_to_clear
= BITS_PER_LONG
- (start
% BITS_PER_LONG
);
28 unsigned long mask_to_clear
= BITMAP_FIRST_WORD_MASK(start
);
30 while (len
- bits_to_clear
>= 0) {
33 bits_to_clear
= BITS_PER_LONG
;
38 mask_to_clear
&= BITMAP_LAST_WORD_MASK(size
);