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
This commit is contained in:
manu 2020-05-09 17:52:50 +00:00
parent fa3e936dba
commit 9130c9b4e2

View File

@ -254,6 +254,17 @@ bitmap_complement(unsigned long *dst, const unsigned long *src,
dst[i] = ~src[i];
}
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)
@ -276,6 +287,17 @@ bitmap_and(unsigned long *dst, const unsigned long *src1,
dst[i] = src1[i] & src2[i];
}
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)