From 1745c23a122cf04013e18631802670421415be21 Mon Sep 17 00:00:00 2001 From: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> Date: Wed, 10 Mar 2021 12:36:47 -0800 Subject: [PATCH] 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 --- yoga/BitUtils.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yoga/BitUtils.h b/yoga/BitUtils.h index 1c32e9ec..2161effc 100644 --- a/yoga/BitUtils.h +++ b/yoga/BitUtils.h @@ -45,8 +45,9 @@ void setEnumData(uint32_t& flags, size_t index, int newValue) { template void setEnumData(uint8_t& flags, size_t index, int newValue) { - flags = (flags & ~mask(bitWidthFn(), index)) | - ((newValue << index) & (mask(bitWidthFn(), index))); + flags = (flags & ~static_cast(mask(bitWidthFn(), index))) | + ((newValue << index) & + (static_cast(mask(bitWidthFn(), index)))); } constexpr bool getBooleanData(int flags, size_t index) {