Use bitfields for YGLayout and YGNode

Summary:
@public

Further heap size reductions by using bitfields in `YGLayout` and `YGNode`.

Reviewed By: SidharthGuglani

Differential Revision: D13466325

fbshipit-source-id: ddcef0a1b3822e7449fe485d99c920d54139c893
This commit is contained in:
David Aurelio
2018-12-18 08:11:25 -08:00
committed by Facebook Github Bot
parent 885b4cbdfb
commit f6415889ca
2 changed files with 18 additions and 10 deletions

View File

@@ -17,11 +17,13 @@ struct YGLayout {
std::array<float, 6> margin = {};
std::array<float, 6> border = {};
std::array<float, 6> padding = {};
YGDirection direction = YGDirectionInherit;
YGDirection direction : 2;
bool didUseLegacyFlag : 1;
bool doesLegacyStretchFlagAffectsLayout : 1;
bool hadOverflow : 1;
uint32_t computedFlexBasisGeneration = 0;
YGFloatOptional computedFlexBasis = {};
bool hadOverflow = false;
// Instead of recomputing the entire layout every single time, we
// cache some information to break early when nothing changed
@@ -34,10 +36,12 @@ struct YGLayout {
std::array<float, 2> measuredDimensions = kYGDefaultDimensionValues;
YGCachedMeasurement cachedLayout = YGCachedMeasurement();
bool didUseLegacyFlag = false;
bool doesLegacyStretchFlagAffectsLayout = false;
YGLayout() = default;
YGLayout()
: direction(YGDirectionInherit),
didUseLegacyFlag(false),
doesLegacyStretchFlagAffectsLayout(false),
hadOverflow(false) {}
bool operator==(YGLayout layout) const;
bool operator!=(YGLayout layout) const {