summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorValentin Schneider <vschneid@redhat.com>2022-10-03 16:34:17 +0100
committerYury Norov <yury.norov@gmail.com>2022-10-06 05:57:36 -0700
commit90d482908eedd56f01a707325aa541cf9c40f936 (patch)
tree26cec02bff42dd83de558ba1b7579185726554b0 /lib
parent78e5a3399421ad79fc024e6d78e2deb7809d26af (diff)
downloadlinux-stable-90d482908eedd56f01a707325aa541cf9c40f936.tar.gz
linux-stable-90d482908eedd56f01a707325aa541cf9c40f936.tar.bz2
linux-stable-90d482908eedd56f01a707325aa541cf9c40f936.zip
lib/find_bit: Introduce find_next_andnot_bit()
In preparation of introducing for_each_cpu_andnot(), add a variant of find_next_bit() that negate the bits in @addr2 when ANDing them with the bits in @addr1. Signed-off-by: Valentin Schneider <vschneid@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/find_bit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/find_bit.c b/lib/find_bit.c
index 25609974cbe4..18bc0a7ac8ee 100644
--- a/lib/find_bit.c
+++ b/lib/find_bit.c
@@ -164,6 +164,15 @@ unsigned long _find_next_and_bit(const unsigned long *addr1, const unsigned long
EXPORT_SYMBOL(_find_next_and_bit);
#endif
+#ifndef find_next_andnot_bit
+unsigned long _find_next_andnot_bit(const unsigned long *addr1, const unsigned long *addr2,
+ unsigned long nbits, unsigned long start)
+{
+ return FIND_NEXT_BIT(addr1[idx] & ~addr2[idx], /* nop */, nbits, start);
+}
+EXPORT_SYMBOL(_find_next_andnot_bit);
+#endif
+
#ifndef find_next_zero_bit
unsigned long _find_next_zero_bit(const unsigned long *addr, unsigned long nbits,
unsigned long start)