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.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 2878811c6134..756d78b8c1c5 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -94,13 +94,13 @@ extern void __bitmap_shift_right(unsigned long *dst,
94 const unsigned long *src, int shift, int bits); 94 const unsigned long *src, int shift, int bits);
95extern void __bitmap_shift_left(unsigned long *dst, 95extern void __bitmap_shift_left(unsigned long *dst,
96 const unsigned long *src, int shift, int bits); 96 const unsigned long *src, int shift, int bits);
97extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 97extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
98 const unsigned long *bitmap2, int bits); 98 const unsigned long *bitmap2, int bits);
99extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 99extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
100 const unsigned long *bitmap2, int bits); 100 const unsigned long *bitmap2, int bits);
101extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 101extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, int bits);
103extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 103extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, int bits);
105extern int __bitmap_intersects(const unsigned long *bitmap1, 105extern int __bitmap_intersects(const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, int bits);
@@ -171,13 +171,12 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
171 } 171 }
172} 172}
173 173
174static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, 174static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
175 const unsigned long *src2, int nbits) 175 const unsigned long *src2, int nbits)
176{ 176{
177 if (small_const_nbits(nbits)) 177 if (small_const_nbits(nbits))
178 *dst = *src1 & *src2; 178 return (*dst = *src1 & *src2) != 0;
179 else 179 return __bitmap_and(dst, src1, src2, nbits);
180 __bitmap_and(dst, src1, src2, nbits);
181} 180}
182 181
183static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 182static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
@@ -198,13 +197,12 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
198 __bitmap_xor(dst, src1, src2, nbits); 197 __bitmap_xor(dst, src1, src2, nbits);
199} 198}
200 199
201static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, 200static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
202 const unsigned long *src2, int nbits) 201 const unsigned long *src2, int nbits)
203{ 202{
204 if (small_const_nbits(nbits)) 203 if (small_const_nbits(nbits))
205 *dst = *src1 & ~(*src2); 204 return (*dst = *src1 & ~(*src2)) != 0;
206 else 205 return __bitmap_andnot(dst, src1, src2, nbits);
207 __bitmap_andnot(dst, src1, src2, nbits);
208} 206}
209 207
210static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 208static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,