summaryrefslogtreecommitdiff
path: root/include/linux/bitmap.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-12-13 16:00:44 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2017-12-13 16:07:21 -0500
commitf2feceddae6f3bd3722247f3458860b955f539bc (patch)
tree6e8405e81ac080995db7cc20ebd51c1e4de5e4cb /include/linux/bitmap.h
parentfa36882a73fbb3fd771c506641a1d70d51c07068 (diff)
Shim layer updates
Diffstat (limited to 'include/linux/bitmap.h')
-rw-r--r--include/linux/bitmap.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 9f47ec2..a7231b8 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -25,6 +25,17 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
#define small_const_nbits(nbits) \
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
+static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
+ unsigned int bits)
+{
+ unsigned int k, lim = bits/BITS_PER_LONG;
+ for (k = 0; k < lim; ++k)
+ dst[k] = ~src[k];
+
+ if (bits % BITS_PER_LONG)
+ dst[k] = ~src[k];
+}
+
static inline void bitmap_zero(unsigned long *dst, int nbits)
{
memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long));