[libc-commits] [PATCH] D95646: [libc][NFC] Add a few casts to suppress loss of precision warnings
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Jan 28 16:56:39 PST 2021
michaelrj updated this revision to Diff 320003.
michaelrj marked an inline comment as done.
michaelrj added a comment.
clarify the type for the constant being shifted
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95646/new/
https://reviews.llvm.org/D95646
Files:
libc/utils/FPUtil/x86_64/FEnv.h
Index: libc/utils/FPUtil/x86_64/FEnv.h
===================================================================
--- libc/utils/FPUtil/x86_64/FEnv.h
+++ libc/utils/FPUtil/x86_64/FEnv.h
@@ -290,11 +290,13 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95646.320003.patch
Type: text/x-patch
Size: 869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210129/b8f9511f/attachment.bin>
More information about the libc-commits
mailing list