Skip to content

Commit

Permalink
8263396: Atomic::CmpxchgByteUsingInt::set_byte_in_int needs an explic…
Browse files Browse the repository at this point in the history
…it cast

Reviewed-by: dholmes
  • Loading branch information
Aleksei Voitylov authored and David Holmes committed Apr 30, 2021
1 parent 07ecd42 commit eb8db12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hotspot/share/runtime/atomic.hpp
Expand Up @@ -818,7 +818,8 @@ inline uint32_t Atomic::CmpxchgByteUsingInt::set_byte_in_int(uint32_t n,
uint8_t b,
uint32_t idx) {
int bitsIdx = BitsPerByte * idx;
return (n & ~(0xff << bitsIdx)) | (b << bitsIdx);
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,
Expand Down

1 comment on commit eb8db12

@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.