From 41c326ee9ff807d5a97be05081c93cc12460933c Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 13 Dec 2018 07:09:31 -0800 Subject: [PATCH] Get rid of `static_cast` in `YGResolveValue` Summary: @public Removes `static_cast` from `YGResolveValue` Reviewed By: SidharthGuglani Differential Revision: D13439605 fbshipit-source-id: 8736541c8e1d43fd698d368cb4f3211ffd929364 --- ReactCommon/yoga/yoga/Utils.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ReactCommon/yoga/yoga/Utils.h b/ReactCommon/yoga/yoga/Utils.h index 9ea7a7384..fed3c1fb1 100644 --- a/ReactCommon/yoga/yoga/Utils.h +++ b/ReactCommon/yoga/yoga/Utils.h @@ -95,16 +95,13 @@ inline YGFloatOptional YGResolveValue( const YGValue value, const float ownerSize) { switch (value.unit) { - case YGUnitUndefined: - case YGUnitAuto: - return YGFloatOptional(); case YGUnitPoint: - return YGFloatOptional(value.value); + return YGFloatOptional{value.value}; case YGUnitPercent: - return YGFloatOptional( - static_cast(value.value * ownerSize * 0.01)); + return YGFloatOptional{value.value * ownerSize * 0.01f}; + default: + return YGFloatOptional{}; } - return YGFloatOptional(); } inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) {