diff options
-rw-r--r-- | include/linux/bitmap.h | 12 | ||||
-rw-r--r-- | lib/bitmap.c | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index cffc89c23c02..c168a807ab9a 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -96,8 +96,8 @@ extern int __bitmap_equal(const unsigned long *bitmap1, | |||
96 | const unsigned long *bitmap2, unsigned int nbits); | 96 | const unsigned long *bitmap2, unsigned int nbits); |
97 | extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, | 97 | extern void __bitmap_complement(unsigned long *dst, const unsigned long *src, |
98 | unsigned int nbits); | 98 | unsigned int nbits); |
99 | extern void __bitmap_shift_right(unsigned long *dst, | 99 | extern void __bitmap_shift_right(unsigned long *dst, const unsigned long *src, |
100 | const unsigned long *src, int shift, int bits); | 100 | unsigned int shift, unsigned int nbits); |
101 | extern void __bitmap_shift_left(unsigned long *dst, | 101 | extern void __bitmap_shift_left(unsigned long *dst, |
102 | const unsigned long *src, int shift, int bits); | 102 | const unsigned long *src, int shift, int bits); |
103 | extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, | 103 | extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
@@ -313,13 +313,13 @@ static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) | |||
313 | return __bitmap_weight(src, nbits); | 313 | return __bitmap_weight(src, nbits); |
314 | } | 314 | } |
315 | 315 | ||
316 | static inline void bitmap_shift_right(unsigned long *dst, | 316 | static inline void bitmap_shift_right(unsigned long *dst, const unsigned long *src, |
317 | const unsigned long *src, int n, int nbits) | 317 | unsigned int shift, int nbits) |
318 | { | 318 | { |
319 | if (small_const_nbits(nbits)) | 319 | if (small_const_nbits(nbits)) |
320 | *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> n; | 320 | *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> shift; |
321 | else | 321 | else |
322 | __bitmap_shift_right(dst, src, n, nbits); | 322 | __bitmap_shift_right(dst, src, shift, nbits); |
323 | } | 323 | } |
324 | 324 | ||
325 | static inline void bitmap_shift_left(unsigned long *dst, | 325 | static inline void bitmap_shift_left(unsigned long *dst, |
diff --git a/lib/bitmap.c b/lib/bitmap.c index d2cd50cd4f5d..45e7d14ebdfd 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -104,17 +104,17 @@ EXPORT_SYMBOL(__bitmap_complement); | |||
104 | * @dst : destination bitmap | 104 | * @dst : destination bitmap |
105 | * @src : source bitmap | 105 | * @src : source bitmap |
106 | * @shift : shift by this many bits | 106 | * @shift : shift by this many bits |
107 | * @bits : bitmap size, in bits | 107 | * @nbits : bitmap size, in bits |
108 | * | 108 | * |
109 | * Shifting right (dividing) means moving bits in the MS -> LS bit | 109 | * Shifting right (dividing) means moving bits in the MS -> LS bit |
110 | * direction. Zeros are fed into the vacated MS positions and the | 110 | * direction. Zeros are fed into the vacated MS positions and the |
111 | * LS bits shifted off the bottom are lost. | 111 | * LS bits shifted off the bottom are lost. |
112 | */ | 112 | */ |
113 | void __bitmap_shift_right(unsigned long *dst, | 113 | void __bitmap_shift_right(unsigned long *dst, const unsigned long *src, |
114 | const unsigned long *src, int shift, int bits) | 114 | unsigned shift, unsigned nbits) |
115 | { | 115 | { |
116 | int k, lim = BITS_TO_LONGS(bits), left = bits % BITS_PER_LONG; | 116 | unsigned k, lim = BITS_TO_LONGS(nbits), left = nbits % BITS_PER_LONG; |
117 | int off = shift/BITS_PER_LONG, rem = shift % BITS_PER_LONG; | 117 | unsigned off = shift/BITS_PER_LONG, rem = shift % BITS_PER_LONG; |
118 | unsigned long mask = (1UL << left) - 1; | 118 | unsigned long mask = (1UL << left) - 1; |
119 | for (k = 0; off + k < lim; ++k) { | 119 | for (k = 0; off + k < lim; ++k) { |
120 | unsigned long upper, lower; | 120 | unsigned long upper, lower; |