aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Connolly2024-07-15 12:08:01 +0200
committerCaleb Connolly2024-07-26 01:28:09 +0200
commit555047df6a79bae4748a72ff8c2e42e242a2a361 (patch)
treea23a9460c7448b5409db8f9a3350cd0e6a3be853
parent1fbd0582a28d108c77d7f9135a7f2c3da2398b72 (diff)
linux/bitmap.h: add bitmap_empty helper
Import this function from Linux as of 6.10-rc6 Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
-rw-r--r--include/linux/bitmap.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 0a8503af9f1..40ca2212cb4 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -196,6 +196,14 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
}
}
+static inline bool bitmap_empty(const unsigned long *src, unsigned int nbits)
+{
+ if (small_const_nbits(nbits))
+ return !(*src & BITMAP_LAST_WORD_MASK(nbits));
+
+ return find_first_bit(src, nbits) == nbits;
+}
+
static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, unsigned int nbits)
{