Skip to content

Commit 2126319

Browse files
committed
Using OPAL_LIKELY for index checking in opal_pointer_array.
1 parent 3c325ca commit 2126319

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

opal/class/opal_pointer_array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int opal_pointer_array_set_item(opal_pointer_array_t *table, int index,
166166
{
167167
assert(table != NULL);
168168

169-
if (0 > index) {
169+
if (OPAL_UNLIKELY(0 > index)) {
170170
return OPAL_ERROR;
171171
}
172172

opal/class/opal_pointer_array.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static inline void *opal_pointer_array_get_item(opal_pointer_array_t *table,
124124
{
125125
void *p;
126126

127-
if( 0 > element_index || table->size <= element_index ) {
127+
if( OPAL_UNLIKELY(0 > element_index || table->size <= element_index) ) {
128128
return NULL;
129129
}
130130
OPAL_THREAD_LOCK(&(table->lock));

0 commit comments

Comments
 (0)