Skip to content

Commit b1dc6fb

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> (cherry picked from commit a24846e)
1 parent bd6811f commit b1dc6fb

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
@@ -976,15 +976,16 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl,
976976
switch (hdr->type) {
977977
case MCA_BTL_BASE_AM_ATOMIC:
978978
if (4 == hdr->data.atomic.size) {
979-
uint32_t tmp = (uint32_t) atomic_response;
980-
mca_btl_base_am_atomic_32(&tmp, (opal_atomic_int32_t *) (uintptr_t) hdr->target_address,
979+
int32_t tmp = (int32_t) atomic_response;
980+
mca_btl_base_am_atomic_32(&tmp, (opal_atomic_int32_t *) hdr->target_address,
981981
hdr->data.atomic.op);
982982
atomic_response = tmp;
983-
}
984-
if (8 == hdr->data.atomic.size) {
985-
mca_btl_base_am_atomic_64(&atomic_response,
986-
(opal_atomic_int64_t *) (uintptr_t) hdr->target_address,
983+
} else if (8 == hdr->data.atomic.size) {
984+
int64_t tmp = (int64_t) atomic_response;
985+
mca_btl_base_am_atomic_64(&tmp,
986+
(opal_atomic_int64_t *) hdr->target_address,
987987
hdr->data.atomic.op);
988+
atomic_response = tmp;
988989
}
989990
break;
990991
case MCA_BTL_BASE_AM_CAS:
@@ -993,8 +994,7 @@ static void mca_btl_base_am_process_atomic(mca_btl_base_module_t *btl,
993994
opal_atomic_compare_exchange_strong_32((opal_atomic_int32_t *) hdr->target_address,
994995
&tmp, (int32_t) hdr->data.atomic.operand[1]);
995996
atomic_response = tmp;
996-
}
997-
if (8 == hdr->data.atomic.size) {
997+
} else if (8 == hdr->data.atomic.size) {
998998
opal_atomic_compare_exchange_strong_64((opal_atomic_int64_t *) hdr->target_address,
999999
&atomic_response, hdr->data.atomic.operand[1]);
10001000
}

0 commit comments

Comments
 (0)