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
Backport-of: 39f4434f44d46548917926c7a802b046197bbe33
  • Loading branch information
shipilev committed Jan 3, 2024
1 parent 21171d9 commit 13ca9b7
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 @@ -1056,14 +1056,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 13ca9b7

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