diff options
Diffstat (limited to 'include/linux/bitmap.h')
| -rw-r--r-- | include/linux/bitmap.h | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 7ad634501e48..e1c8d080c427 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
| @@ -88,32 +88,32 @@ | |||
| 88 | * lib/bitmap.c provides these functions: | 88 | * lib/bitmap.c provides these functions: |
| 89 | */ | 89 | */ |
| 90 | 90 | ||
| 91 | extern int __bitmap_empty(const unsigned long *bitmap, int bits); | 91 | extern int __bitmap_empty(const unsigned long *bitmap, unsigned int nbits); |
| 92 | extern int __bitmap_full(const unsigned long *bitmap, int bits); | 92 | extern int __bitmap_full(const unsigned long *bitmap, unsigned int nbits); |
| 93 | extern int __bitmap_equal(const unsigned long *bitmap1, | 93 | extern int __bitmap_equal(const unsigned long *bitmap1, |
| 94 | const unsigned long *bitmap2, int bits); | 94 | const unsigned long *bitmap2, unsigned int nbits); |
| 95 | extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, | 95 | extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, |
| 96 | int bits); | 96 | unsigned int nbits); |
| 97 | extern void __bitmap_shift_right(unsigned long *dst, | 97 | extern void __bitmap_shift_right(unsigned long *dst, |
| 98 | const unsigned long *src, int shift, int bits); | 98 | const unsigned long *src, int shift, int bits); |
| 99 | extern void __bitmap_shift_left(unsigned long *dst, | 99 | extern void __bitmap_shift_left(unsigned long *dst, |
| 100 | const unsigned long *src, int shift, int bits); | 100 | const unsigned long *src, int shift, int bits); |
| 101 | extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, | 101 | extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
| 102 | const unsigned long *bitmap2, int bits); | 102 | const unsigned long *bitmap2, unsigned int nbits); |
| 103 | extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, | 103 | extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, |
| 104 | const unsigned long *bitmap2, int bits); | 104 | const unsigned long *bitmap2, unsigned int nbits); |
| 105 | extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, | 105 | extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, |
| 106 | const unsigned long *bitmap2, int bits); | 106 | const unsigned long *bitmap2, unsigned int nbits); |
| 107 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, | 107 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
| 108 | const unsigned long *bitmap2, int bits); | 108 | const unsigned long *bitmap2, unsigned int nbits); |
| 109 | extern int __bitmap_intersects(const unsigned long *bitmap1, | 109 | extern int __bitmap_intersects(const unsigned long *bitmap1, |
| 110 | const unsigned long *bitmap2, int bits); | 110 | const unsigned long *bitmap2, unsigned int nbits); |
| 111 | extern int __bitmap_subset(const unsigned long *bitmap1, | 111 | extern int __bitmap_subset(const unsigned long *bitmap1, |
| 112 | const unsigned long *bitmap2, int bits); | 112 | const unsigned long *bitmap2, unsigned int nbits); |
| 113 | extern int __bitmap_weight(const unsigned long *bitmap, int bits); | 113 | extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits); |
| 114 | 114 | ||
| 115 | extern void bitmap_set(unsigned long *map, int i, int len); | 115 | extern void bitmap_set(unsigned long *map, unsigned int start, int len); |
| 116 | extern void bitmap_clear(unsigned long *map, int start, int nr); | 116 | extern void bitmap_clear(unsigned long *map, unsigned int start, int len); |
| 117 | extern unsigned long bitmap_find_next_zero_area(unsigned long *map, | 117 | extern unsigned long bitmap_find_next_zero_area(unsigned long *map, |
| 118 | unsigned long size, | 118 | unsigned long size, |
| 119 | unsigned long start, | 119 | unsigned long start, |
| @@ -140,9 +140,9 @@ extern void bitmap_onto(unsigned long *dst, const unsigned long *orig, | |||
| 140 | const unsigned long *relmap, int bits); | 140 | const unsigned long *relmap, int bits); |
| 141 | extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, | 141 | extern void bitmap_fold(unsigned long *dst, const unsigned long *orig, |
| 142 | int sz, int bits); | 142 | int sz, int bits); |
| 143 | extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); | 143 | extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); |
| 144 | extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); | 144 | extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); |
| 145 | extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); | 145 | extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); |
| 146 | extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); | 146 | extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); |
| 147 | extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); | 147 | extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); |
| 148 | 148 | ||
| @@ -188,15 +188,15 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, | |||
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, | 190 | static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, |
| 191 | const unsigned long *src2, int nbits) | 191 | const unsigned long *src2, unsigned int nbits) |
| 192 | { | 192 | { |
| 193 | if (small_const_nbits(nbits)) | 193 | if (small_const_nbits(nbits)) |
| 194 | return (*dst = *src1 & *src2) != 0; | 194 | return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0; |
| 195 | return __bitmap_and(dst, src1, src2, nbits); | 195 | return __bitmap_and(dst, src1, src2, nbits); |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, | 198 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, |
| 199 | const unsigned long *src2, int nbits) | 199 | const unsigned long *src2, unsigned int nbits) |
| 200 | { | 200 | { |
| 201 | if (small_const_nbits(nbits)) | 201 | if (small_const_nbits(nbits)) |
| 202 | *dst = *src1 | *src2; | 202 | *dst = *src1 | *src2; |
| @@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, | |||
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, | 207 | static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, |
| 208 | const unsigned long *src2, int nbits) | 208 | const unsigned long *src2, unsigned int nbits) |
| 209 | { | 209 | { |
| 210 | if (small_const_nbits(nbits)) | 210 | if (small_const_nbits(nbits)) |
| 211 | *dst = *src1 ^ *src2; | 211 | *dst = *src1 ^ *src2; |
| @@ -214,24 +214,24 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, | |||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, | 216 | static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, |
| 217 | const unsigned long *src2, int nbits) | 217 | const unsigned long *src2, unsigned int nbits) |
| 218 | { | 218 | { |
| 219 | if (small_const_nbits(nbits)) | 219 | if (small_const_nbits(nbits)) |
| 220 | return (*dst = *src1 & ~(*src2)) != 0; | 220 | return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; |
| 221 | return __bitmap_andnot(dst, src1, src2, nbits); | 221 | return __bitmap_andnot(dst, src1, src2, nbits); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, | 224 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, |
| 225 | int nbits) | 225 | unsigned int nbits) |
| 226 | { | 226 | { |
| 227 | if (small_const_nbits(nbits)) | 227 | if (small_const_nbits(nbits)) |
| 228 | *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); | 228 | *dst = ~(*src); |
| 229 | else | 229 | else |
| 230 | __bitmap_complement(dst, src, nbits); | 230 | __bitmap_complement(dst, src, nbits); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | static inline int bitmap_equal(const unsigned long *src1, | 233 | static inline int bitmap_equal(const unsigned long *src1, |
| 234 | const unsigned long *src2, int nbits) | 234 | const unsigned long *src2, unsigned int nbits) |
| 235 | { | 235 | { |
| 236 | if (small_const_nbits(nbits)) | 236 | if (small_const_nbits(nbits)) |
| 237 | return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); | 237 | return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -240,7 +240,7 @@ static inline int bitmap_equal(const unsigned long *src1, | |||
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | static inline int bitmap_intersects(const unsigned long *src1, | 242 | static inline int bitmap_intersects(const unsigned long *src1, |
| 243 | const unsigned long *src2, int nbits) | 243 | const unsigned long *src2, unsigned int nbits) |
| 244 | { | 244 | { |
| 245 | if (small_const_nbits(nbits)) | 245 | if (small_const_nbits(nbits)) |
| 246 | return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; | 246 | return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; |
| @@ -249,7 +249,7 @@ static inline int bitmap_intersects(const unsigned long *src1, | |||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | static inline int bitmap_subset(const unsigned long *src1, | 251 | static inline int bitmap_subset(const unsigned long *src1, |
| 252 | const unsigned long *src2, int nbits) | 252 | const unsigned long *src2, unsigned int nbits) |
| 253 | { | 253 | { |
| 254 | if (small_const_nbits(nbits)) | 254 | if (small_const_nbits(nbits)) |
| 255 | return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); | 255 | return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -257,7 +257,7 @@ static inline int bitmap_subset(const unsigned long *src1, | |||
| 257 | return __bitmap_subset(src1, src2, nbits); | 257 | return __bitmap_subset(src1, src2, nbits); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | static inline int bitmap_empty(const unsigned long *src, int nbits) | 260 | static inline int bitmap_empty(const unsigned long *src, unsigned nbits) |
| 261 | { | 261 | { |
| 262 | if (small_const_nbits(nbits)) | 262 | if (small_const_nbits(nbits)) |
| 263 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); | 263 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -265,7 +265,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits) | |||
| 265 | return __bitmap_empty(src, nbits); | 265 | return __bitmap_empty(src, nbits); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static inline int bitmap_full(const unsigned long *src, int nbits) | 268 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) |
| 269 | { | 269 | { |
| 270 | if (small_const_nbits(nbits)) | 270 | if (small_const_nbits(nbits)) |
| 271 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); | 271 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -273,7 +273,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits) | |||
| 273 | return __bitmap_full(src, nbits); | 273 | return __bitmap_full(src, nbits); |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | static inline int bitmap_weight(const unsigned long *src, int nbits) | 276 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) |
| 277 | { | 277 | { |
| 278 | if (small_const_nbits(nbits)) | 278 | if (small_const_nbits(nbits)) |
| 279 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); | 279 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -284,7 +284,7 @@ static inline void bitmap_shift_right(unsigned long *dst, | |||
| 284 | const unsigned long *src, int n, int nbits) | 284 | const unsigned long *src, int n, int nbits) |
| 285 | { | 285 | { |
| 286 | if (small_const_nbits(nbits)) | 286 | if (small_const_nbits(nbits)) |
| 287 | *dst = *src >> n; | 287 | *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n; |
| 288 | else | 288 | else |
| 289 | __bitmap_shift_right(dst, src, n, nbits); | 289 | __bitmap_shift_right(dst, src, n, nbits); |
| 290 | } | 290 | } |
