Skip to content

Commit a24846e

Browse files
committed
btl/base: fix some compiler warnings
Also, remove a superflous (uintptr_t) cast, and add an obvious "else" to make the code a little more readable. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent 3037dfd commit a24846e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

opal/mca/btl/base/btl_base_am_rdma.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2011-2018 Los Alamos National Security, LLC. All rights
44
* reserved.
55
* Copyright (c) 2020-2021 Google, LLC. All rights reserved.
6-
* Copyright (c) 2021 Cisco Systems, Inc. All rights reserved
6+
* Copyright (c) 2021-2022 Cisco Systems, Inc. All rights reserved
77
* $COPYRIGHT$
88
*
99
* Additional copyrights may follow
@@ -990,15 +990,16 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl,
990990
switch (hdr->type) {
991991
case MCA_BTL_BASE_AM_ATOMIC:
992992
if (4 == hdr->data.atomic.size) {
993-
uint32_t tmp = (uint32_t) atomic_response;
994-
mca_btl_base_am_atomic_32(&tmp, (opal_atomic_int32_t *) (uintptr_t) hdr->target_address,
993+
int32_t tmp = (int32_t) atomic_response;
994+
mca_btl_base_am_atomic_32(&tmp, (opal_atomic_int32_t *) hdr->target_address,
995995
hdr->data.atomic.op);
996996
atomic_response = tmp;
997-
}
998-
if (8 == hdr->data.atomic.size) {
999-
mca_btl_base_am_atomic_64(&atomic_response,
1000-
(opal_atomic_int64_t *) (uintptr_t) hdr->target_address,
997+
} else if (8 == hdr->data.atomic.size) {
998+
int64_t tmp = (int64_t) atomic_response;
999+
mca_btl_base_am_atomic_64(&tmp,
1000+
(opal_atomic_int64_t *) hdr->target_address,
10011001
hdr->data.atomic.op);
1002+
atomic_response = tmp;
10021003
}
10031004
break;
10041005
case MCA_BTL_BASE_AM_CAS:
@@ -1007,8 +1008,7 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl,
10071008
opal_atomic_compare_exchange_strong_32((opal_atomic_int32_t *) hdr->target_address,
10081009
&tmp, (int32_t) hdr->data.atomic.operand[1]);
10091010
atomic_response = tmp;
1010-
}
1011-
if (8 == hdr->data.atomic.size) {
1011+
} else if (8 == hdr->data.atomic.size) {
10121012
opal_atomic_compare_exchange_strong_64((opal_atomic_int64_t *) hdr->target_address,
10131013
&atomic_response, hdr->data.atomic.operand[1]);
10141014
}

0 commit comments

Comments
 (0)