aboutsummaryrefslogtreecommitdiffstats
path: root/lib/find_bit.c
diff options
context:
space:
mode:
authorYury Norov <[email protected]>2023-01-21 04:24:28 +0000
committerJakub Kicinski <[email protected]>2023-02-08 02:20:00 +0000
commit43245117806ff8914e37327b610fc08b5ddedc91 (patch)
tree916c35e8e73811ab05db9d066e9cf7f423d56090 /lib/find_bit.c
parentMerge branch 'net-core-use-a-dedicated-kmem_cache-for-skb-head-allocs' (diff)
downloadkernel-43245117806ff8914e37327b610fc08b5ddedc91.tar.gz
kernel-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 <[email protected]> Acked-by: Tariq Toukan <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Reviewed-by: Peter Lafreniere <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
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)