Dont assume a size for constants with UL and ULL.
According to Section 6.4.4.1 of the C, we do not need to prepend a type to a constant to get the right size. The compiler will infer the type according to the number of bits in the constant. Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
Этот коммит содержится в:
родитель
29411472f2
Коммит
ba46b35515
@ -87,6 +87,10 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
|
||||
* A classical find first zero bit (ffs) on a large array. It checks starting
|
||||
* from the indicated position until it finds a zero bit. If SET is true,
|
||||
* the bit is set. The position of the bit is returned in store.
|
||||
*
|
||||
* According to Section 6.4.4.1 of the C standard we don't need to prepend a type
|
||||
* indicator to constants (the type is inferred by the compiler according to
|
||||
* the number of bits necessary to represent it).
|
||||
*/
|
||||
#define FIND_FIRST_ZERO(START_IDX, STORE) \
|
||||
do { \
|
||||
@ -96,27 +100,27 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
|
||||
break; \
|
||||
} \
|
||||
GET_BIT_POS((START_IDX), __b_idx, __b_pos); \
|
||||
for (; table->free_bits[__b_idx] == 0xFFFFFFFFFFFFFFFFULL; __b_idx++); \
|
||||
for (; table->free_bits[__b_idx] == 0xFFFFFFFFFFFFFFFFu; __b_idx++); \
|
||||
assert(__b_idx < (uint32_t)table->size); \
|
||||
uint64_t __check_value = table->free_bits[__b_idx]; \
|
||||
__b_pos = 0; \
|
||||
\
|
||||
if( 0x00000000FFFFFFFFULL == (__check_value & 0x00000000FFFFFFFFULL) ) { \
|
||||
if( 0x00000000FFFFFFFFu == (__check_value & 0x00000000FFFFFFFFu) ) { \
|
||||
__check_value >>= 32; __b_pos += 32; \
|
||||
} \
|
||||
if( 0x000000000000FFFFULL == (__check_value & 0x000000000000FFFFULL) ) { \
|
||||
if( 0x000000000000FFFFu == (__check_value & 0x000000000000FFFFu) ) { \
|
||||
__check_value >>= 16; __b_pos += 16; \
|
||||
} \
|
||||
if( 0x00000000000000FFULL == (__check_value & 0x00000000000000FFULL) ) { \
|
||||
if( 0x00000000000000FFu == (__check_value & 0x00000000000000FFu) ) { \
|
||||
__check_value >>= 8; __b_pos += 8; \
|
||||
} \
|
||||
if( 0x000000000000000FULL == (__check_value & 0x000000000000000FULL) ) { \
|
||||
if( 0x000000000000000Fu == (__check_value & 0x000000000000000Fu) ) { \
|
||||
__check_value >>= 4; __b_pos += 4; \
|
||||
} \
|
||||
if( 0x0000000000000003ULL == (__check_value & 0x0000000000000003ULL) ) { \
|
||||
if( 0x0000000000000003u == (__check_value & 0x0000000000000003u) ) { \
|
||||
__check_value >>= 2; __b_pos += 2; \
|
||||
} \
|
||||
if( 0x0000000000000001ULL == (__check_value & 0x0000000000000001ULL) ) { \
|
||||
if( 0x0000000000000001u == (__check_value & 0x0000000000000001u) ) { \
|
||||
__b_pos += 1; \
|
||||
} \
|
||||
(STORE) = (__b_idx * 8 * sizeof(uint64_t)) + __b_pos; \
|
||||
@ -129,8 +133,8 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
|
||||
do { \
|
||||
uint32_t __b_idx, __b_pos; \
|
||||
GET_BIT_POS((IDX), __b_idx, __b_pos); \
|
||||
assert( 0 == (table->free_bits[__b_idx] & (1UL << __b_pos))); \
|
||||
table->free_bits[__b_idx] |= (1ULL << __b_pos); \
|
||||
assert( 0 == (table->free_bits[__b_idx] & (((uint64_t)1) << __b_pos))); \
|
||||
table->free_bits[__b_idx] |= (((uint64_t)1) << __b_pos); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
@ -140,8 +144,8 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
|
||||
do { \
|
||||
uint32_t __b_idx, __b_pos; \
|
||||
GET_BIT_POS((IDX), __b_idx, __b_pos); \
|
||||
assert( (table->free_bits[__b_idx] & (1UL << __b_pos))); \
|
||||
table->free_bits[__b_idx] ^= (1ULL << __b_pos); \
|
||||
assert( (table->free_bits[__b_idx] & (((uint64_t)1) << __b_pos))); \
|
||||
table->free_bits[__b_idx] ^= (((uint64_t)1) << __b_pos); \
|
||||
} while(0)
|
||||
|
||||
#if 0
|
||||
@ -159,9 +163,9 @@ static void opal_pointer_array_validate(opal_pointer_array_t *array)
|
||||
GET_BIT_POS(i, b_idx, p_idx);
|
||||
if( NULL == array->addr[i] ) {
|
||||
cnt++;
|
||||
assert( 0 == (array->free_bits[b_idx] & (1ULL << p_idx)) );
|
||||
assert( 0 == (array->free_bits[b_idx] & (((uint64_t)1) << p_idx)) );
|
||||
} else {
|
||||
assert( 0 != (array->free_bits[b_idx] & (1ULL << p_idx)) );
|
||||
assert( 0 != (array->free_bits[b_idx] & (((uint64_t)1) << p_idx)) );
|
||||
}
|
||||
}
|
||||
assert(cnt == array->number_free);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user