summaryrefslogtreecommitdiffstats
path: root/lib/find_bit.c
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2023-01-20 20:24:28 -0800
committerJakub Kicinski <kuba@kernel.org>2023-02-07 18:20:00 -0800
commit43245117806ff8914e37327b610fc08b5ddedc91 (patch)
tree916c35e8e73811ab05db9d066e9cf7f423d56090 /lib/find_bit.c
parent383d9f87a06dd923c4fd0fdcb65b58258851f545 (diff)
downloadlinux-43245117806ff8914e37327b610fc08b5ddedc91.tar.gz
linux-43245117806ff8914e37327b610fc08b5ddedc91.tar.bz2
linux-43245117806ff8914e37327b610fc08b5ddedc91.zip
lib/find: introduce find_nth_and_andnot_bit
In the following patches the function is used to implement in-place bitmaps traversing without storing intermediate result in temporary bitmaps. Signed-off-by: Yury Norov <yury.norov@gmail.com> Acked-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Peter Lafreniere <peter@n8pjl.ca> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'lib/find_bit.c')
-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 18bc0a7ac8ee..c10920e66788 100644
--- a/lib/find_bit.c
+++ b/lib/find_bit.c
@@ -155,6 +155,15 @@ unsigned long __find_nth_andnot_bit(const unsigned long *addr1, const unsigned l
}
EXPORT_SYMBOL(__find_nth_andnot_bit);
+unsigned long __find_nth_and_andnot_bit(const unsigned long *addr1,
+ const unsigned long *addr2,
+ const unsigned long *addr3,
+ unsigned long size, unsigned long n)
+{
+ return FIND_NTH_BIT(addr1[idx] & addr2[idx] & ~addr3[idx], size, n);
+}
+EXPORT_SYMBOL(__find_nth_and_andnot_bit);
+
#ifndef find_next_and_bit
unsigned long _find_next_and_bit(const unsigned long *addr1, const unsigned long *addr2,
unsigned long nbits, unsigned long start)