aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2020-05-09 17:52:50 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2020-05-09 17:52:50 +0000
commit26a578697cbd1799fd491cf192780ac41bde17fc (patch)
treefbfc9488f6e82830f4d18f22ca95eb3237f6cf37
parent937b352e23839361e7bcbc84d0e180c1c3bb9285 (diff)
downloadsrc-26a578697cbd1799fd491cf192780ac41bde17fc.tar.gz
src-26a578697cbd1799fd491cf192780ac41bde17fc.zip
linuxkpi: Add bitmap_copy and bitmap_andnot
bitmap_copy simply copy the bitmaps, no idea why it exists. bitmap_andnot is similar to bitmap_and but uses !src2. Sponsored-by: The FreeBSD Foundation Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D24782
Notes
Notes: svn path=/head/; revision=360851
-rw-r--r--sys/compat/linuxkpi/common/include/linux/bitmap.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/bitmap.h b/sys/compat/linuxkpi/common/include/linux/bitmap.h
index c323e42d17f4..08dd69bce180 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitmap.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitmap.h
@@ -255,6 +255,17 @@ bitmap_complement(unsigned long *dst, const unsigned long *src,
}
static inline void
+bitmap_copy(unsigned long *dst, const unsigned long *src,
+ const unsigned int size)
+{
+ const unsigned int end = BITS_TO_LONGS(size);
+ unsigned int i;
+
+ for (i = 0; i != end; i++)
+ dst[i] = src[i];
+}
+
+static inline void
bitmap_or(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, const unsigned int size)
{
@@ -277,6 +288,17 @@ bitmap_and(unsigned long *dst, const unsigned long *src1,
}
static inline void
+bitmap_andnot(unsigned long *dst, const unsigned long *src1,
+ const unsigned long *src2, const unsigned int size)
+{
+ const unsigned int end = BITS_TO_LONGS(size);
+ unsigned int i;
+
+ for (i = 0; i != end; i++)
+ dst[i] = src1[i] & ~src2[i];
+}
+
+static inline void
bitmap_xor(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, const unsigned int size)
{