Move utility functions to utils file

Summary: Move utility functions to utils file

Reviewed By: emilsjolander

Differential Revision: D6682933

fbshipit-source-id: 0fd90fdaf5ca4f9b7a11cbd15d8c54c7d0ce8a03
This commit is contained in:
Pritesh Nandgaonkar
2018-01-10 04:30:27 -08:00
committed by Facebook Github Bot
parent dc6ed89bfa
commit 47543c8fba
4 changed files with 42 additions and 17 deletions

23
yoga/Utils.cpp Normal file
View File

@@ -0,0 +1,23 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include "Utils.h"
bool YGValueEqual(const YGValue a, const YGValue b) {
if (a.unit != b.unit) {
return false;
}
if (a.unit == YGUnitUndefined ||
(std::isnan(a.value) && std::isnan(b.value))) {
return true;
}
return fabs(a.value - b.value) < 0.0001f;
}