aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/bitmap.h8
-rw-r--r--lib/bitmap.c30
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
290static inline int bitmap_full(const unsigned long *src, unsigned int nbits) 290static 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
298static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) 298static 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
45int __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}
58EXPORT_SYMBOL(__bitmap_empty);
59
60int __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}
73EXPORT_SYMBOL(__bitmap_full);
74
75int __bitmap_equal(const unsigned long *bitmap1, 45int __bitmap_equal(const unsigned long *bitmap1,
76 const unsigned long *bitmap2, unsigned int bits) 46 const unsigned long *bitmap2, unsigned int bits)
77{ 47{