lib/bitmap.c: more signed->unsigned conversions
For consistency with the other bitmap_* functions, also make the nbits parameter of bitmap_zero, bitmap_fill and bitmap_copy unsigned. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d1214c65c0
commit
8b4daad52f
@ -185,33 +185,33 @@ extern int bitmap_print_to_pagebuf(bool list, char *buf,
|
|||||||
#define small_const_nbits(nbits) \
|
#define small_const_nbits(nbits) \
|
||||||
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
||||||
|
|
||||||
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
|
||||||
{
|
{
|
||||||
if (small_const_nbits(nbits))
|
if (small_const_nbits(nbits))
|
||||||
*dst = 0UL;
|
*dst = 0UL;
|
||||||
else {
|
else {
|
||||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||||
memset(dst, 0, len);
|
memset(dst, 0, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bitmap_fill(unsigned long *dst, int nbits)
|
static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
|
||||||
{
|
{
|
||||||
size_t nlongs = BITS_TO_LONGS(nbits);
|
unsigned int nlongs = BITS_TO_LONGS(nbits);
|
||||||
if (!small_const_nbits(nbits)) {
|
if (!small_const_nbits(nbits)) {
|
||||||
int len = (nlongs - 1) * sizeof(unsigned long);
|
unsigned int len = (nlongs - 1) * sizeof(unsigned long);
|
||||||
memset(dst, 0xff, len);
|
memset(dst, 0xff, len);
|
||||||
}
|
}
|
||||||
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
|
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
||||||
int nbits)
|
unsigned int nbits)
|
||||||
{
|
{
|
||||||
if (small_const_nbits(nbits))
|
if (small_const_nbits(nbits))
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
else {
|
else {
|
||||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||||
memcpy(dst, src, len);
|
memcpy(dst, src, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user