Skip to content

Commit f29109a

Browse files
committed
Return faster if nothing to do.
Signed-off-by: George Bosilca <[email protected]>
1 parent 86961a2 commit f29109a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

opal/datatype/opal_datatype_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ struct opal_datatype_t;
539539
# define OPAL_DATATYPE_SAFEGUARD_POINTER(ACTPTR, LENGTH, INITPTR, PDATA, COUNT) \
540540
{ \
541541
unsigned char *__lower_bound = (INITPTR), *__upper_bound; \
542-
assert(((LENGTH) != 0) && ((COUNT) != 0)); \
542+
assert( (COUNT) != 0 ); \
543543
__lower_bound += (PDATA)->true_lb; \
544544
__upper_bound = (INITPTR) + (PDATA)->true_ub + \
545545
((PDATA)->ub - (PDATA)->lb) * ((COUNT) -1); \

opal/datatype/opal_datatype_position.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ static inline void position_single_block(opal_convertor_t *CONVERTOR, unsigned c
6666
}
6767

6868
/**
69-
* Advance the convertors' position according. Update the pointer and the remaining space
70-
* accordingly.
69+
* Advance the convertors' position according to account for *COUNT elements. Update
70+
* the pointer and the remaining space accordingly.
7171
*/
7272
static inline void position_predefined_data(opal_convertor_t *CONVERTOR, dt_elem_desc_t *ELEM,
7373
size_t *COUNT, unsigned char **POINTER, size_t *SPACE)
@@ -82,7 +82,8 @@ static inline void position_predefined_data(opal_convertor_t *CONVERTOR, dt_elem
8282

8383
if (cando_count > *(COUNT)) {
8484
cando_count = *(COUNT);
85-
}
85+
} else if( 0 == cando_count )
86+
return;
8687

8788
if (1 == _elem->blocklen) {
8889
DO_DEBUG(opal_output(0,

0 commit comments

Comments
 (0)