1
1

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.
Этот коммит содержится в:
Ralph Castain 2005-06-08 18:32:53 +00:00
родитель 066e49b7be
Коммит 2095525596
3 изменённых файлов: 10 добавлений и 12 удалений

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

@ -71,14 +71,14 @@ orte_bitmap_init(orte_bitmap_t *bm, size_t size)
} }
bm->array_size = actual_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); orte_bitmap_clear_all_bits(bm);
return ORTE_SUCCESS; return ORTE_SUCCESS;
} }
int 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; 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 */ /* Update the array_size */
bm->array_size = new_size; bm->array_size = new_size;
bm->legal_numbits = new_size*8; bm->legal_numbits = new_size*SIZE_OF_CHAR;
} }
return ORTE_SUCCESS; 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 */ /* 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); ORTE_ERROR_LOG(rc);
return 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 */ /* 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); ORTE_ERROR_LOG(rc);
return 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; return ORTE_ERR_BAD_PARAM;
} }
/* Neglect all which dont have an unset bit */ /* Neglect all which don't have an unset bit */
*position = 0; *position = 0;
while((i < bm->array_size) && (bm->bitmap[i] == all_ones)) { while((i < bm->array_size) && (bm->bitmap[i] == all_ones)) {
++i; ++i;

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

@ -81,7 +81,7 @@ OMPI_DECLSPEC int orte_bitmap_init (orte_bitmap_t *bm, size_t size);
* @return ORTE error code or success * @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);
/** /**

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

@ -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 * below), we could potentially go outside the range of
* the array * the array
*/ */
if (orte_gpr_replica_globals.srch_itag.legal_numbits < itags[j]) { if (ORTE_SUCCESS != (rc = orte_bitmap_resize(&(orte_gpr_replica_globals.srch_itag), itags[j]))) {
if (ORTE_SUCCESS != (rc = orte_bitmap_cover_bit(&(orte_gpr_replica_globals.srch_itag), itags[j]))) { ORTE_ERROR_LOG(rc);
ORTE_ERROR_LOG(rc); return rc;
return rc;
}
} }
if (entry_itags[i] == itags[j]) { /* found a match */ 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]))) { if (ORTE_SUCCESS != (rc = orte_bitmap_set_bit(&(orte_gpr_replica_globals.srch_itag), itags[j]))) {