[libc][NFC] Add a few casts to suppress loss of precision warnings

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D95646
This commit is contained in:
Michael Jones 2021-01-28 23:53:27 +00:00
parent ad4a6ce10c
commit d4eea5cf0f
1 changed files with 6 additions and 4 deletions

View File

@ -290,11 +290,13 @@ static inline int setRound(int mode) {
return 1; // To indicate failure
}
uint16_t x87Value = bitValue << internal::X87RoundingControlBitPosition;
uint16_t x87Value = static_cast<uint16_t>(
bitValue << internal::X87RoundingControlBitPosition);
uint16_t x87Control = internal::getX87ControlWord();
x87Control =
(x87Control & ~(0x3 << internal::X87RoundingControlBitPosition)) |
x87Value;
x87Control = static_cast<uint16_t>(
(x87Control &
~(uint16_t(0x3) << internal::X87RoundingControlBitPosition)) |
x87Value);
internal::writeX87ControlWord(x87Control);
uint32_t mxcsrValue = bitValue << internal::MXCSRRoundingControlBitPosition;