mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-19 18:21:41 +00:00
include: sbi/sbi_hartmask: add equality helper
Add sbi_hartmask_equal() to check whether two hartmasks contain the same hart indexes. Reviewed-by: Rahul Pathak <rahul.pathak@oss.qualcomm.com> Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Oza Pawandeep <pawandeep.oza@oss.qualcomm.com> Link: https://lore.kernel.org/r/20261118215549.2499040-3-pawandeep.oza@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
1 parent
75974e7cb1
commit
f3b940b112
1 file changed
+21
@@ -206,4 +206,25 @@ static inline int sbi_hartmask_weight(const struct sbi_hartmask *srcp)
|
||||
(__i) < SBI_HARTMASK_MAX_BITS; \
|
||||
(__i) = find_next_bit((__m)->bits, SBI_HARTMASK_MAX_BITS, (__i) + 1))
|
||||
|
||||
|
||||
/**
|
||||
* Check whether two hartmasks are equal
|
||||
* @param a the first hartmask to compare
|
||||
* @param b the second hartmask to compare
|
||||
*
|
||||
* Return: true if both hartmasks contain the same harts, false otherwise
|
||||
*/
|
||||
static inline bool sbi_hartmask_equal(const struct sbi_hartmask *a,
|
||||
const struct sbi_hartmask *b)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < BITS_TO_LONGS(SBI_HARTMASK_MAX_BITS); i++) {
|
||||
if (a->bits[i] != b->bits[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user