diff options
-rw-r--r-- | include/linux/bitmap.h | 8 | ||||
-rw-r--r-- | lib/bitmap.c | 30 |
2 files changed, 4 insertions, 34 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index be4fa5ddf36c..ea17cca9e685 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -283,16 +283,16 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) | |||
283 | { | 283 | { |
284 | if (small_const_nbits(nbits)) | 284 | if (small_const_nbits(nbits)) |
285 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); | 285 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
286 | else | 286 | |
287 | return __bitmap_empty(src, nbits); | 287 | return find_first_bit(src, nbits) == nbits; |
288 | } | 288 | } |
289 | 289 | ||
290 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) | 290 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) |
291 | { | 291 | { |
292 | if (small_const_nbits(nbits)) | 292 | if (small_const_nbits(nbits)) |
293 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); | 293 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
294 | else | 294 | |
295 | return __bitmap_full(src, nbits); | 295 | return find_first_zero_bit(src, nbits) == nbits; |
296 | } | 296 | } |
297 | 297 | ||
298 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) | 298 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) |
diff --git a/lib/bitmap.c b/lib/bitmap.c index d456f4c15a9f..64c0926f5dd8 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -42,36 +42,6 @@ | |||
42 | * for the best explanations of this ordering. | 42 | * for the best explanations of this ordering. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | int __bitmap_empty(const unsigned long *bitmap, unsigned int bits) | ||
46 | { | ||
47 | unsigned int k, lim = bits/BITS_PER_LONG; | ||
48 | for (k = 0; k < lim; ++k) | ||
49 | if (bitmap[k]) | ||
50 | return 0; | ||
51 | |||
52 | if (bits % BITS_PER_LONG) | ||
53 | if (bitmap[k] & BITMAP_LAST_WORD_MASK(bits)) | ||
54 | return 0; | ||
55 | |||
56 | return 1; | ||
57 | } | ||
58 | EXPORT_SYMBOL(__bitmap_empty); | ||
59 | |||
60 | int __bitmap_full(const unsigned long *bitmap, unsigned int bits) | ||
61 | { | ||
62 | unsigned int k, lim = bits/BITS_PER_LONG; | ||
63 | for (k = 0; k < lim; ++k) | ||
64 | if (~bitmap[k]) | ||
65 | return 0; | ||
66 | |||
67 | if (bits % BITS_PER_LONG) | ||
68 | if (~bitmap[k] & BITMAP_LAST_WORD_MASK(bits)) | ||
69 | return 0; | ||
70 | |||
71 | return 1; | ||
72 | } | ||
73 | EXPORT_SYMBOL(__bitmap_full); | ||
74 | |||
75 | int __bitmap_equal(const unsigned long *bitmap1, | 45 | int __bitmap_equal(const unsigned long *bitmap1, |
76 | const unsigned long *bitmap2, unsigned int bits) | 46 | const unsigned long *bitmap2, unsigned int bits) |
77 | { | 47 | { |