2018-01-10 04:30:27 -08:00
|
|
|
/**
|
|
|
|
* 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"
|
|
|
|
|
2018-01-11 04:47:35 -08:00
|
|
|
YGFlexDirection YGFlexDirectionCross(
|
|
|
|
const YGFlexDirection flexDirection,
|
|
|
|
const YGDirection direction) {
|
|
|
|
return YGFlexDirectionIsColumn(flexDirection)
|
|
|
|
? YGResolveFlexDirection(YGFlexDirectionRow, direction)
|
|
|
|
: YGFlexDirectionColumn;
|
|
|
|
}
|
|
|
|
|
2018-01-10 04:30:27 -08:00
|
|
|
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;
|
|
|
|
}
|