Skip to content

Commit

Permalink
Fix various C++ warnings (#31002)
Browse files Browse the repository at this point in the history
Summary:
Fix warnings about implicit type truncation.

## Changelog

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

Pull Request resolved: facebook/react-native#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
  • Loading branch information
acoates-ms authored and facebook-github-bot committed Mar 10, 2021
1 parent 4b00973 commit afc2f63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/yoga/src/main/cpp/yoga/BitUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit afc2f63

Please sign in to comment.