Switch storage in YGStyle to CompactValue

Summary:
@public

Switches the storage in `facebook::yoga::detail::Values` from `YGValue` to `facebook::yoga::detail::CompactValue`.
This cuts heap size for arrays of values in half.

Reviewed By: SidharthGuglani

Differential Revision: D13465586

fbshipit-source-id: 49a4d6d29a73bdd44843b1f3c57bf746050c94d6
This commit is contained in:
David Aurelio
2018-12-18 08:11:24 -08:00
committed by Facebook Github Bot
parent 8461aeaef0
commit 885b4cbdfb
7 changed files with 195 additions and 191 deletions

View File

@@ -7,6 +7,7 @@
#pragma once
#include "YGNode.h"
#include "Yoga-internal.h"
#include "CompactValue.h"
// This struct is an helper model to hold the data for step 4 of flexbox
// algo, which is collecting the flex items in a line.
@@ -124,8 +125,7 @@ inline YGFlexDirection YGResolveFlexDirection(
}
inline YGFloatOptional YGResolveValueMargin(
const YGValue value,
yoga::detail::CompactValue value,
const float ownerSize) {
return value.unit == YGUnitAuto ? YGFloatOptional(0)
: YGResolveValue(value, ownerSize);
return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize);
}