X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=include%2Flinux%2Fbitmap.h;h=dcc5de7cc487673f786f25c2598091549121d351;hb=b68c5f546e951d718edf611c4bd9853753e4b366;hp=d9ed27969855d2811ed7c9dbf6f416b598a40b25;hpb=3e8e7c93d7eb091463839b5212789c4aae09459e;p=powerpc.git diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index d9ed279698..dcc5de7cc4 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -24,6 +24,9 @@ * The available bitmap operations and their rough meaning in the * case that the bitmap is a single unsigned long are thus: * + * Note that nbits should be always a compile time evaluable constant. + * Otherwise many inlines will generate horrible code. + * * bitmap_zero(dst, nbits) *dst = 0UL * bitmap_fill(dst, nbits) *dst = ~0UL * bitmap_copy(dst, src, nbits) *dst = *src @@ -244,6 +247,8 @@ static inline int bitmap_full(const unsigned long *src, int nbits) static inline int bitmap_weight(const unsigned long *src, int nbits) { + if (nbits <= BITS_PER_LONG) + return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); return __bitmap_weight(src, nbits); }