@@ -87,6 +87,10 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
87
87
* A classical find first zero bit (ffs) on a large array. It checks starting
88
88
* from the indicated position until it finds a zero bit. If SET is true,
89
89
* the bit is set. The position of the bit is returned in store.
90
+ *
91
+ * According to Section 6.4.4.1 of the C standard we don't need to prepend a type
92
+ * indicator to constants (the type is inferred by the compiler according to
93
+ * the number of bits necessary to represent it).
90
94
*/
91
95
#define FIND_FIRST_ZERO (START_IDX , STORE ) \
92
96
do { \
@@ -96,27 +100,27 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
96
100
break; \
97
101
} \
98
102
GET_BIT_POS((START_IDX), __b_idx, __b_pos); \
99
- for (; table->free_bits[__b_idx] == 0xFFFFFFFFFFFFFFFFULL ; __b_idx++); \
103
+ for (; table->free_bits[__b_idx] == 0xFFFFFFFFFFFFFFFFu ; __b_idx++); \
100
104
assert(__b_idx < (uint32_t)table->size); \
101
105
uint64_t __check_value = table->free_bits[__b_idx]; \
102
106
__b_pos = 0; \
103
107
\
104
- if( 0x00000000FFFFFFFFULL == (__check_value & 0x00000000FFFFFFFFULL ) ) { \
108
+ if( 0x00000000FFFFFFFFu == (__check_value & 0x00000000FFFFFFFFu ) ) { \
105
109
__check_value >>= 32; __b_pos += 32; \
106
110
} \
107
- if( 0x000000000000FFFFULL == (__check_value & 0x000000000000FFFFULL ) ) { \
111
+ if( 0x000000000000FFFFu == (__check_value & 0x000000000000FFFFu ) ) { \
108
112
__check_value >>= 16; __b_pos += 16; \
109
113
} \
110
- if( 0x00000000000000FFULL == (__check_value & 0x00000000000000FFULL ) ) { \
114
+ if( 0x00000000000000FFu == (__check_value & 0x00000000000000FFu ) ) { \
111
115
__check_value >>= 8; __b_pos += 8; \
112
116
} \
113
- if( 0x000000000000000FULL == (__check_value & 0x000000000000000FULL ) ) { \
117
+ if( 0x000000000000000Fu == (__check_value & 0x000000000000000Fu ) ) { \
114
118
__check_value >>= 4; __b_pos += 4; \
115
119
} \
116
- if( 0x0000000000000003ULL == (__check_value & 0x0000000000000003ULL ) ) { \
120
+ if( 0x0000000000000003u == (__check_value & 0x0000000000000003u ) ) { \
117
121
__check_value >>= 2; __b_pos += 2; \
118
122
} \
119
- if( 0x0000000000000001ULL == (__check_value & 0x0000000000000001ULL ) ) { \
123
+ if( 0x0000000000000001u == (__check_value & 0x0000000000000001u ) ) { \
120
124
__b_pos += 1; \
121
125
} \
122
126
(STORE) = (__b_idx * 8 * sizeof(uint64_t)) + __b_pos; \
@@ -129,8 +133,8 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
129
133
do { \
130
134
uint32_t __b_idx, __b_pos; \
131
135
GET_BIT_POS((IDX), __b_idx, __b_pos); \
132
- assert( 0 == (table->free_bits[__b_idx] & (1UL << __b_pos))); \
133
- table->free_bits[__b_idx] |= (1ULL << __b_pos); \
136
+ assert( 0 == (table->free_bits[__b_idx] & (((uint64_t)1) << __b_pos))); \
137
+ table->free_bits[__b_idx] |= (((uint64_t)1) << __b_pos); \
134
138
} while(0)
135
139
136
140
/**
@@ -140,8 +144,8 @@ static void opal_pointer_array_destruct(opal_pointer_array_t *array)
140
144
do { \
141
145
uint32_t __b_idx, __b_pos; \
142
146
GET_BIT_POS((IDX), __b_idx, __b_pos); \
143
- assert( (table->free_bits[__b_idx] & (1UL << __b_pos))); \
144
- table->free_bits[__b_idx] ^= (1ULL << __b_pos); \
147
+ assert( (table->free_bits[__b_idx] & (((uint64_t)1) << __b_pos))); \
148
+ table->free_bits[__b_idx] ^= (((uint64_t)1) << __b_pos); \
145
149
} while(0)
146
150
147
151
#if 0
@@ -159,9 +163,9 @@ static void opal_pointer_array_validate(opal_pointer_array_t *array)
159
163
GET_BIT_POS (i , b_idx , p_idx );
160
164
if ( NULL == array -> addr [i ] ) {
161
165
cnt ++ ;
162
- assert ( 0 == (array -> free_bits [b_idx ] & (1ULL << p_idx )) );
166
+ assert ( 0 == (array -> free_bits [b_idx ] & ((( uint64_t ) 1 ) << p_idx )) );
163
167
} else {
164
- assert ( 0 != (array -> free_bits [b_idx ] & (1ULL << p_idx )) );
168
+ assert ( 0 != (array -> free_bits [b_idx ] & ((( uint64_t ) 1 ) << p_idx )) );
165
169
}
166
170
}
167
171
assert (cnt == array -> number_free );
0 commit comments