Fix various C++ warnings (#31002)

Summary:
Fix warnings about implicit type truncation.

## Changelog

[Internal] [Fixed] - Fix various C++ warnings

Pull Request resolved: https://github.com/facebook/react-native/pull/31002

Test Plan:
Almost all the changes here are simply making explicit conversions which are already occurring.  With the exception of a couple of constants being changed from doubles to floats.

With these changes I am able to remove a bunch of warning suppressions in react-native-windows.

Reviewed By: shergin

Differential Revision: D26900502

Pulled By: rozele

fbshipit-source-id: d5e415282815c2212a840a863713287bbf118c10
This commit is contained in:
Andrew Coates
2021-03-10 12:36:47 -08:00
committed by Facebook GitHub Bot
parent ccdea0f31b
commit 1745c23a12

View File

@@ -45,8 +45,9 @@ void setEnumData(uint32_t& flags, size_t index, int newValue) {
template <typename Enum>
void setEnumData(uint8_t& flags, size_t index, int newValue) {
flags = (flags & ~mask(bitWidthFn<Enum>(), index)) |
((newValue << index) & (mask(bitWidthFn<Enum>(), index)));
flags = (flags & ~static_cast<uint8_t>(mask(bitWidthFn<Enum>(), index))) |
((newValue << index) &
(static_cast<uint8_t>(mask(bitWidthFn<Enum>(), index))));
}
constexpr bool getBooleanData(int flags, size_t index) {