aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2014-08-06 19:09:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:26 -0400
commit2f9305eb31097fdd3dc86daca65d8097d1fcf2ff (patch)
tree6b6ecf6c0a60a531f6f2f9bdec7ef400defddb6f
parent65b4ee62c9cd10640f0054f47fd84c7920e8c118 (diff)
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: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/bitmap.h16
-rw-r--r--lib/bitmap.c24
2 files changed, 20 insertions, 20 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index f42d72d5fe82..7048782fe5b9 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -99,13 +99,13 @@ extern void __bitmap_shift_right(unsigned long *dst,
99extern void __bitmap_shift_left(unsigned long *dst, 99extern void __bitmap_shift_left(unsigned long *dst,
100 const unsigned long *src, int shift, int bits); 100 const unsigned long *src, int shift, int bits);
101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 101extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, unsigned int nbits);
103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 103extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, unsigned int nbits);
105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 105extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, unsigned int nbits);
107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 107extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
108 const unsigned long *bitmap2, int bits); 108 const unsigned long *bitmap2, unsigned int nbits);
109extern int __bitmap_intersects(const unsigned long *bitmap1, 109extern int __bitmap_intersects(const unsigned long *bitmap1,
110 const unsigned long *bitmap2, int bits); 110 const unsigned long *bitmap2, int bits);
111extern int __bitmap_subset(const unsigned long *bitmap1, 111extern int __bitmap_subset(const unsigned long *bitmap1,
@@ -188,7 +188,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
188} 188}
189 189
190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, 190static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
191 const unsigned long *src2, int nbits) 191 const unsigned long *src2, unsigned int nbits)
192{ 192{
193 if (small_const_nbits(nbits)) 193 if (small_const_nbits(nbits))
194 return (*dst = *src1 & *src2) != 0; 194 return (*dst = *src1 & *src2) != 0;
@@ -196,7 +196,7 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
196} 196}
197 197
198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 198static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 199 const unsigned long *src2, unsigned int nbits)
200{ 200{
201 if (small_const_nbits(nbits)) 201 if (small_const_nbits(nbits))
202 *dst = *src1 | *src2; 202 *dst = *src1 | *src2;
@@ -205,7 +205,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
205} 205}
206 206
207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 207static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
208 const unsigned long *src2, int nbits) 208 const unsigned long *src2, unsigned int nbits)
209{ 209{
210 if (small_const_nbits(nbits)) 210 if (small_const_nbits(nbits))
211 *dst = *src1 ^ *src2; 211 *dst = *src1 ^ *src2;
@@ -214,7 +214,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
214} 214}
215 215
216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, 216static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
217 const unsigned long *src2, int nbits) 217 const unsigned long *src2, unsigned int nbits)
218{ 218{
219 if (small_const_nbits(nbits)) 219 if (small_const_nbits(nbits))
220 return (*dst = *src1 & ~(*src2)) != 0; 220 return (*dst = *src1 & ~(*src2)) != 0;
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 4387e3c092fd..03207373cc5a 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -182,10 +182,10 @@ void __bitmap_shift_left(unsigned long *dst,
182EXPORT_SYMBOL(__bitmap_shift_left); 182EXPORT_SYMBOL(__bitmap_shift_left);
183 183
184int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 184int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
185 const unsigned long *bitmap2, int bits) 185 const unsigned long *bitmap2, unsigned int bits)
186{ 186{
187 int k; 187 unsigned int k;
188 int nr = BITS_TO_LONGS(bits); 188 unsigned int nr = BITS_TO_LONGS(bits);
189 unsigned long result = 0; 189 unsigned long result = 0;
190 190
191 for (k = 0; k < nr; k++) 191 for (k = 0; k < nr; k++)
@@ -195,10 +195,10 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
195EXPORT_SYMBOL(__bitmap_and); 195EXPORT_SYMBOL(__bitmap_and);
196 196
197void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 197void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
198 const unsigned long *bitmap2, int bits) 198 const unsigned long *bitmap2, unsigned int bits)
199{ 199{
200 int k; 200 unsigned int k;
201 int nr = BITS_TO_LONGS(bits); 201 unsigned int nr = BITS_TO_LONGS(bits);
202 202
203 for (k = 0; k < nr; k++) 203 for (k = 0; k < nr; k++)
204 dst[k] = bitmap1[k] | bitmap2[k]; 204 dst[k] = bitmap1[k] | bitmap2[k];
@@ -206,10 +206,10 @@ void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
206EXPORT_SYMBOL(__bitmap_or); 206EXPORT_SYMBOL(__bitmap_or);
207 207
208void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 208void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
209 const unsigned long *bitmap2, int bits) 209 const unsigned long *bitmap2, unsigned int bits)
210{ 210{
211 int k; 211 unsigned int k;
212 int nr = BITS_TO_LONGS(bits); 212 unsigned int nr = BITS_TO_LONGS(bits);
213 213
214 for (k = 0; k < nr; k++) 214 for (k = 0; k < nr; k++)
215 dst[k] = bitmap1[k] ^ bitmap2[k]; 215 dst[k] = bitmap1[k] ^ bitmap2[k];
@@ -217,10 +217,10 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
217EXPORT_SYMBOL(__bitmap_xor); 217EXPORT_SYMBOL(__bitmap_xor);
218 218
219int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 219int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
220 const unsigned long *bitmap2, int bits) 220 const unsigned long *bitmap2, unsigned int bits)
221{ 221{
222 int k; 222 unsigned int k;
223 int nr = BITS_TO_LONGS(bits); 223 unsigned int nr = BITS_TO_LONGS(bits);
224 unsigned long result = 0; 224 unsigned long result = 0;
225 225
226 for (k = 0; k < nr; k++) 226 for (k = 0; k < nr; k++)