Commit 2f9305eb authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds

lib: bitmap: make nbits parameter of bitmap_{and,or,xor,andnot} unsigned

This change is only for consistency with the changes to the other
bitmap_* functions; it doesn't change the size of the generated code:
inside BITS_TO_LONGS there is a sizeof(long), which causes bits to be
interpreted as unsigned anyway.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 65b4ee62
...@@ -99,13 +99,13 @@ extern void __bitmap_shift_right(unsigned long *dst, ...@@ -99,13 +99,13 @@ extern void __bitmap_shift_right(unsigned long *dst,
extern void __bitmap_shift_left(unsigned long *dst, extern void __bitmap_shift_left(unsigned long *dst,
const unsigned long *src, int shift, int bits); const unsigned long *src, int shift, int bits);
extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits); const unsigned long *bitmap2, unsigned int nbits);
extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits); const unsigned long *bitmap2, unsigned int nbits);
extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits); const unsigned long *bitmap2, unsigned int nbits);
extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits); const unsigned long *bitmap2, unsigned int nbits);
extern int __bitmap_intersects(const unsigned long *bitmap1, extern int __bitmap_intersects(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits); const unsigned long *bitmap2, int bits);
extern int __bitmap_subset(const unsigned long *bitmap1, extern int __bitmap_subset(const unsigned long *bitmap1,
...@@ -188,7 +188,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, ...@@ -188,7 +188,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
} }
static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits) const unsigned long *src2, unsigned int nbits)
{ {
if (small_const_nbits(nbits)) if (small_const_nbits(nbits))
return (*dst = *src1 & *src2) != 0; return (*dst = *src1 & *src2) != 0;
...@@ -196,7 +196,7 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, ...@@ -196,7 +196,7 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
} }
static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits) const unsigned long *src2, unsigned int nbits)
{ {
if (small_const_nbits(nbits)) if (small_const_nbits(nbits))
*dst = *src1 | *src2; *dst = *src1 | *src2;
...@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, ...@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
} }
static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits) const unsigned long *src2, unsigned int nbits)
{ {
if (small_const_nbits(nbits)) if (small_const_nbits(nbits))
*dst = *src1 ^ *src2; *dst = *src1 ^ *src2;
...@@ -214,7 +214,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, ...@@ -214,7 +214,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
} }
static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits) const unsigned long *src2, unsigned int nbits)
{ {
if (small_const_nbits(nbits)) if (small_const_nbits(nbits))
return (*dst = *src1 & ~(*src2)) != 0; return (*dst = *src1 & ~(*src2)) != 0;
......
...@@ -182,10 +182,10 @@ void __bitmap_shift_left(unsigned long *dst, ...@@ -182,10 +182,10 @@ void __bitmap_shift_left(unsigned long *dst,
EXPORT_SYMBOL(__bitmap_shift_left); EXPORT_SYMBOL(__bitmap_shift_left);
int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits) const unsigned long *bitmap2, unsigned int bits)
{ {
int k; unsigned int k;
int nr = BITS_TO_LONGS(bits); unsigned int nr = BITS_TO_LONGS(bits);
unsigned long result = 0; unsigned long result = 0;
for (k = 0; k < nr; k++) for (k = 0; k < nr; k++)
...@@ -195,10 +195,10 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, ...@@ -195,10 +195,10 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
EXPORT_SYMBOL(__bitmap_and); EXPORT_SYMBOL(__bitmap_and);
void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits) const unsigned long *bitmap2, unsigned int bits)
{ {
int k; unsigned int k;
int nr = BITS_TO_LONGS(bits); unsigned int nr = BITS_TO_LONGS(bits);
for (k = 0; k < nr; k++) for (k = 0; k < nr; k++)
dst[k] = bitmap1[k] | bitmap2[k]; dst[k] = bitmap1[k] | bitmap2[k];
...@@ -206,10 +206,10 @@ void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, ...@@ -206,10 +206,10 @@ void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
EXPORT_SYMBOL(__bitmap_or); EXPORT_SYMBOL(__bitmap_or);
void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits) const unsigned long *bitmap2, unsigned int bits)
{ {
int k; unsigned int k;
int nr = BITS_TO_LONGS(bits); unsigned int nr = BITS_TO_LONGS(bits);
for (k = 0; k < nr; k++) for (k = 0; k < nr; k++)
dst[k] = bitmap1[k] ^ bitmap2[k]; dst[k] = bitmap1[k] ^ bitmap2[k];
...@@ -217,10 +217,10 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, ...@@ -217,10 +217,10 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
EXPORT_SYMBOL(__bitmap_xor); EXPORT_SYMBOL(__bitmap_xor);
int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits) const unsigned long *bitmap2, unsigned int bits)
{ {
int k; unsigned int k;
int nr = BITS_TO_LONGS(bits); unsigned int nr = BITS_TO_LONGS(bits);
unsigned long result = 0; unsigned long result = 0;
for (k = 0; k < nr; k++) for (k = 0; k < nr; k++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment