Extend the bitmap API a bit to provide a test if all bits zero
This commit was SVN r28486.
Этот коммит содержится в:
родитель
427b6b0b47
Коммит
c33219a51b
@ -440,3 +440,21 @@ int opal_bitmap_num_set_bits(opal_bitmap_t *bm, int len)
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
bool opal_bitmap_is_clear(opal_bitmap_t *bm)
|
||||
{
|
||||
int i, len;
|
||||
int index, offset;
|
||||
|
||||
len = bm->array_size * SIZE_OF_CHAR;
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
index = i / SIZE_OF_CHAR;
|
||||
offset = i % SIZE_OF_CHAR;
|
||||
|
||||
if (0 != (bm->bitmap[index] & (1 << offset))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -246,6 +246,11 @@ OPAL_DECLSPEC int opal_bitmap_num_unset_bits(opal_bitmap_t *bm, int len);
|
||||
*/
|
||||
OPAL_DECLSPEC int opal_bitmap_num_set_bits(opal_bitmap_t *bm, int len);
|
||||
|
||||
/**
|
||||
* Check a bitmap to see if any bit is set
|
||||
*/
|
||||
OPAL_DECLSPEC bool opal_bitmap_is_clear(opal_bitmap_t *bm);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user