From db1b07c02ca35cf05d5388cb35c18f576835800f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 3 Feb 2010 19:45:22 +0000 Subject: [PATCH] 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. --- opal/class/opal_bitmap.c | 10 +++++----- opal/class/opal_bitmap.h | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/opal/class/opal_bitmap.c b/opal/class/opal_bitmap.c index b57da83a83..6a8895706b 100644 --- a/opal/class/opal_bitmap.c +++ b/opal/class/opal_bitmap.c @@ -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; } diff --git a/opal/class/opal_bitmap.h b/opal/class/opal_bitmap.h index 21173cfa98..a27a754668 100644 --- a/opal/class/opal_bitmap.h +++ b/opal/class/opal_bitmap.h @@ -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); /**