From 209552559638f1d212da584bdc3711a866efe089 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 8 Jun 2005 18:32:53 +0000 Subject: [PATCH] Fix a couple of minor thiings per Jeff's suggestions: 1. Change the hardcoded "8" to "SIZE_OF_CHAR" 2. Change "cover_bit" to "resize" Also removed an extra "if" check that was duplicative. Again, tested on up to 100 processes. This commit was SVN r5983. --- src/class/orte_bitmap.c | 12 ++++++------ src/class/orte_bitmap.h | 2 +- .../replica/functional_layer/gpr_replica_dict_fn.c | 8 +++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/class/orte_bitmap.c b/src/class/orte_bitmap.c index 56ffe1a6ad..9791cbdcf1 100644 --- a/src/class/orte_bitmap.c +++ b/src/class/orte_bitmap.c @@ -71,14 +71,14 @@ orte_bitmap_init(orte_bitmap_t *bm, size_t size) } bm->array_size = actual_size; - bm->legal_numbits = 8*actual_size; + bm->legal_numbits = SIZE_OF_CHAR*actual_size; orte_bitmap_clear_all_bits(bm); return ORTE_SUCCESS; } int -orte_bitmap_cover_bit(orte_bitmap_t *bm, size_t bit) +orte_bitmap_resize(orte_bitmap_t *bm, size_t bit) { size_t index, new_size, i; @@ -109,7 +109,7 @@ orte_bitmap_cover_bit(orte_bitmap_t *bm, size_t bit) /* Update the array_size */ bm->array_size = new_size; - bm->legal_numbits = new_size*8; + bm->legal_numbits = new_size*SIZE_OF_CHAR; } return ORTE_SUCCESS; @@ -127,7 +127,7 @@ orte_bitmap_set_bit(orte_bitmap_t *bm, size_t bit) } /* make sure the bitmap covers the requested bit */ - if (ORTE_SUCCESS != (rc = orte_bitmap_cover_bit(bm, bit))) { + if (ORTE_SUCCESS != (rc = orte_bitmap_resize(bm, bit))) { ORTE_ERROR_LOG(rc); return rc; } @@ -154,7 +154,7 @@ orte_bitmap_clear_bit(orte_bitmap_t *bm, size_t bit) } /* make sure the bitmap covers the requested bit */ - if (ORTE_SUCCESS != (rc = orte_bitmap_cover_bit(bm, bit))) { + if (ORTE_SUCCESS != (rc = orte_bitmap_resize(bm, bit))) { ORTE_ERROR_LOG(rc); return rc; } @@ -236,7 +236,7 @@ orte_bitmap_find_and_set_first_unset_bit(orte_bitmap_t *bm, size_t *position) return ORTE_ERR_BAD_PARAM; } - /* Neglect all which dont have an unset bit */ + /* Neglect all which don't have an unset bit */ *position = 0; while((i < bm->array_size) && (bm->bitmap[i] == all_ones)) { ++i; diff --git a/src/class/orte_bitmap.h b/src/class/orte_bitmap.h index eb46a062c4..973211a285 100644 --- a/src/class/orte_bitmap.h +++ b/src/class/orte_bitmap.h @@ -81,7 +81,7 @@ OMPI_DECLSPEC int orte_bitmap_init (orte_bitmap_t *bm, size_t size); * @return ORTE error code or success * */ -OMPI_DECLSPEC int orte_bitmap_cover_bit(orte_bitmap_t *bm, size_t bit); +OMPI_DECLSPEC int orte_bitmap_resize(orte_bitmap_t *bm, size_t bit); /** diff --git a/src/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c b/src/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c index e91ea043e8..6c795f848d 100644 --- a/src/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c +++ b/src/mca/gpr/replica/functional_layer/gpr_replica_dict_fn.c @@ -75,11 +75,9 @@ bool orte_gpr_replica_check_itag_list(orte_gpr_replica_addr_mode_t addr_mode, * below), we could potentially go outside the range of * the array */ - if (orte_gpr_replica_globals.srch_itag.legal_numbits < itags[j]) { - if (ORTE_SUCCESS != (rc = orte_bitmap_cover_bit(&(orte_gpr_replica_globals.srch_itag), itags[j]))) { - ORTE_ERROR_LOG(rc); - return rc; - } + if (ORTE_SUCCESS != (rc = orte_bitmap_resize(&(orte_gpr_replica_globals.srch_itag), itags[j]))) { + ORTE_ERROR_LOG(rc); + return rc; } if (entry_itags[i] == itags[j]) { /* found a match */ if (ORTE_SUCCESS != (rc = orte_bitmap_set_bit(&(orte_gpr_replica_globals.srch_itag), itags[j]))) {