1
1

In multiple places in the code base, we expect opal_bitmap_is_set_bit to return either true or false...not a negative error code. If the index is out of range, this is effectively a "false" condition as the bit was clearly not set by the program.

This revision is consistent with how the function was called in the OMPI code base. Will fix the test to match.

This commit was SVN r22544.
Этот коммит содержится в:
Ralph Castain 2010-02-03 19:45:22 +00:00
родитель 7ad3d310b8
Коммит db1b07c02c
2 изменённых файлов: 10 добавлений и 9 удалений

Просмотреть файл

@ -180,27 +180,27 @@ opal_bitmap_clear_bit(opal_bitmap_t *bm, int bit)
}
int
bool
opal_bitmap_is_set_bit(opal_bitmap_t *bm, int bit)
{
int index, offset;
if ((bit < 0) || NULL == bm || (bit >= (bm->array_size * SIZE_OF_CHAR))) {
return OPAL_ERR_BAD_PARAM;
return false;
}
index = bit / SIZE_OF_CHAR;
offset = bit % SIZE_OF_CHAR;
if (index >= bm->array_size) {
return OPAL_ERR_BAD_PARAM;
return false;
}
if (0 != (bm->bitmap[index] & (1 << offset))) {
return (int) true;
return true;
}
return (int) false;
return false;
}

Просмотреть файл

@ -114,12 +114,13 @@ OPAL_DECLSPEC int opal_bitmap_clear_bit(opal_bitmap_t *bm, int bit);
*
* @param bitmap The input bitmap (IN)
* @param bit The bit which is to be checked (IN)
* @return OPAL error code if the bit is out of range
* 1 if the bit is set
* 0 if the bit is not set
* @return true if the bit is set
* false if the bit is not set OR the index
* is outside the bounds of the provided
* bitmap
*
*/
OPAL_DECLSPEC int opal_bitmap_is_set_bit(opal_bitmap_t *bm, int bit);
OPAL_DECLSPEC bool opal_bitmap_is_set_bit(opal_bitmap_t *bm, int bit);
/**