From b2a4e67fee87b0c54609850bcb7a07660b8ca972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Fri, 3 Mar 2017 10:16:41 -0800 Subject: [PATCH] Use floats to prevent double calculation + float casting on scale Summary: Use ```float``` for calculation, as we would calculate with ```double``` and cast to float afterwards otherwise. So this removes the warning. Closes https://github.com/facebook/yoga/pull/450 Reviewed By: astreet Differential Revision: D4642267 Pulled By: emilsjolander fbshipit-source-id: 184ef24474f2b8a42654a71a8e98839296648b2b --- yoga/Yoga.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yoga/Yoga.c b/yoga/Yoga.c index 3f85dfeb..1e4311da 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -3290,18 +3290,18 @@ bool YGLayoutNodeInternal(const YGNodeRef node, static float gPointScaleFactor = 1.0; void YGSetPointScaleFactor(float pixelsInPoint) { - YG_ASSERT(pixelsInPoint >= 0.0, "Scale factor should not be less than zero"); + YG_ASSERT(pixelsInPoint >= 0.0f, "Scale factor should not be less than zero"); // We store points for Pixel as we will use it for rounding - if (pixelsInPoint == 0.0) { + if (pixelsInPoint == 0.0f) { // Zero is used to skip rounding - gPointScaleFactor = 0.0; + gPointScaleFactor = 0.0f; } else { - gPointScaleFactor = 1.0 / pixelsInPoint; + gPointScaleFactor = 1.0f / pixelsInPoint; } } static void YGRoundToPixelGrid(const YGNodeRef node) { - if (gPointScaleFactor == 0.0) { + if (gPointScaleFactor == 0.0f) { return; } const float nodeLeft = node->layout.position[YGEdgeLeft];