-
Enhancement
-
Resolution: Fixed
-
P4
-
19
-
b22
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8322965 | 17.0.11 | Aleksey Shipilev | P4 | Resolved | Fixed | b01 |
Only use unsigned types in [gs]et_byte_in_int (atomic.hpp). In the code below, bitsIdx ought to be uint32_t instead of int.
```
inline uint32_t Atomic::CmpxchgByteUsingInt::set_byte_in_int(uint32_t n,
uint8_t b,
uint32_t idx) {
int 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;
return (uint8_t)(n >> bitsIdx);
}
```
```
inline uint32_t Atomic::CmpxchgByteUsingInt::set_byte_in_int(uint32_t n,
uint8_t b,
uint32_t idx) {
int 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;
return (uint8_t)(n >> bitsIdx);
}
```
- backported by
-
JDK-8322965 Stop mixing signed and unsigned types in bit operations
-
- Resolved
-