aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bitmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bitmap.h')
-rw-r--r--include/linux/bitmap.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dbfbf4990005..be4fa5ddf36c 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -172,12 +172,8 @@ extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int
172extern int bitmap_print_to_pagebuf(bool list, char *buf, 172extern int bitmap_print_to_pagebuf(bool list, char *buf,
173 const unsigned long *maskp, int nmaskbits); 173 const unsigned long *maskp, int nmaskbits);
174 174
175#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) 175#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
176#define BITMAP_LAST_WORD_MASK(nbits) \ 176#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
177( \
178 ((nbits) % BITS_PER_LONG) ? \
179 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
180)
181 177
182#define small_const_nbits(nbits) \ 178#define small_const_nbits(nbits) \
183 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) 179 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)