diff options
author | Yury Norov <yury.norov@gmail.com> | 2022-07-01 15:54:25 +0300 |
---|---|---|
committer | Yury Norov <yury.norov@gmail.com> | 2022-07-15 16:35:54 +0300 |
commit | 4dea97f8636d0514befc9fc5cf342b351b7d0e20 (patch) | |
tree | 229c6eb22cd7c99bbe8d942a8f1b84465199a2fa /tools/include/linux/bitmap.h | |
parent | e2863a78593d638d3924a6f67900c4820034f349 (diff) | |
download | linux-4dea97f8636d0514befc9fc5cf342b351b7d0e20.tar.xz |
lib/bitmap: change type of bitmap_weight to unsigned long
bitmap_weight() doesn't return negative values, so change it's type
to unsigned long. It may help compiler to generate better code and
catch bugs.
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Diffstat (limited to 'tools/include/linux/bitmap.h')
-rw-r--r-- | tools/include/linux/bitmap.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h index 2ae7ab8ed7d1..ae1852e39142 100644 --- a/tools/include/linux/bitmap.h +++ b/tools/include/linux/bitmap.h @@ -11,7 +11,7 @@ #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] -int __bitmap_weight(const unsigned long *bitmap, int bits); +unsigned long __bitmap_weight(const unsigned long *bitmap, unsigned int bits); void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, const unsigned long *bitmap2, int bits); bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, @@ -61,7 +61,7 @@ static inline bool bitmap_full(const unsigned long *src, unsigned int nbits) return find_first_zero_bit(src, nbits) == nbits; } -static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) +static inline unsigned long bitmap_weight(const unsigned long *src, unsigned int nbits) { if (small_const_nbits(nbits)) return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); |