From 9680ae98a69d62b8c4308be554b35515de62678a Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 6 Dec 2018 07:35:10 -0800 Subject: [PATCH] Get rid of `static_cast` in `YGResolveValue` Summary: @public Removes `static_cast` from `YGResolveValue` Reviewed By: SidharthGuglani Differential Revision: D13209155 fbshipit-source-id: 76c27c89f6217af9dfef9e2620d639c9f3e212f5 --- yoga/Utils.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/yoga/Utils.h b/yoga/Utils.h index 204b2718..2a52eb2a 100644 --- a/yoga/Utils.h +++ b/yoga/Utils.h @@ -100,16 +100,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) {