Skip to content

Commit

Permalink
8286312: Stop mixing signed and unsigned types in bit operations
Browse files Browse the repository at this point in the history
Reviewed-by: coleenp, dholmes
  • Loading branch information
lkorinth committed May 9, 2022
1 parent b490a58 commit 39f4434
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/atomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,14 @@ inline T Atomic::cmpxchg_using_helper(Fn fn,
inline uint32_t Atomic::CmpxchgByteUsingInt::set_byte_in_int(uint32_t n,
uint8_t b,
uint32_t idx) {
int bitsIdx = BitsPerByte * idx;
uint32_t bitsIdx = BitsPerByte * idx;
return (n & ~(static_cast<uint32_t>(0xff) << bitsIdx))
| (static_cast<uint32_t>(b) << bitsIdx);
}

inline uint8_t Atomic::CmpxchgByteUsingInt::get_byte_in_int(uint32_t n,
uint32_t idx) {
int bitsIdx = BitsPerByte * idx;
uint32_t bitsIdx = BitsPerByte * idx;
return (uint8_t)(n >> bitsIdx);
}

Expand Down

1 comment on commit 39f4434

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.