Use bitfields for enum members of YGStyle
Summary: @public Puts all enum fields of `YGStyle` into bitfields. This saves 36 bytes (> 3%) per node. Reviewed By: SidharthGuglani Differential Revision: D13233686 fbshipit-source-id: 3ef7e0d6913f0254806acb942d9a9f5b78a5af9c
This commit is contained in:
committed by
Facebook Github Bot
parent
5a65261a55
commit
4248fd9d4c
@@ -30,16 +30,16 @@ constexpr std::array<YGValue, 2> kYGDefaultDimensionValuesUnit = {
|
|||||||
struct YGStyle {
|
struct YGStyle {
|
||||||
using Dimensions = std::array<YGValue, 2>;
|
using Dimensions = std::array<YGValue, 2>;
|
||||||
|
|
||||||
YGDirection direction = YGDirectionInherit;
|
YGDirection direction : 2;
|
||||||
YGFlexDirection flexDirection = YGFlexDirectionColumn;
|
YGFlexDirection flexDirection : 2;
|
||||||
YGJustify justifyContent = YGJustifyFlexStart;
|
YGJustify justifyContent : 3;
|
||||||
YGAlign alignContent = YGAlignFlexStart;
|
YGAlign alignContent : 3;
|
||||||
YGAlign alignItems = YGAlignStretch;
|
YGAlign alignItems : 3;
|
||||||
YGAlign alignSelf = YGAlignAuto;
|
YGAlign alignSelf : 3;
|
||||||
YGPositionType positionType = YGPositionTypeRelative;
|
YGPositionType positionType : 1;
|
||||||
YGWrap flexWrap = YGWrapNoWrap;
|
YGWrap flexWrap : 2;
|
||||||
YGOverflow overflow = YGOverflowVisible;
|
YGOverflow overflow : 2;
|
||||||
YGDisplay display = YGDisplayFlex;
|
YGDisplay display : 1;
|
||||||
YGFloatOptional flex = {};
|
YGFloatOptional flex = {};
|
||||||
YGFloatOptional flexGrow = {};
|
YGFloatOptional flexGrow = {};
|
||||||
YGFloatOptional flexShrink = {};
|
YGFloatOptional flexShrink = {};
|
||||||
@@ -54,7 +54,17 @@ struct YGStyle {
|
|||||||
// Yoga specific properties, not compatible with flexbox specification
|
// Yoga specific properties, not compatible with flexbox specification
|
||||||
YGFloatOptional aspectRatio = {};
|
YGFloatOptional aspectRatio = {};
|
||||||
|
|
||||||
YGStyle() = default;
|
YGStyle()
|
||||||
|
: direction(YGDirectionInherit),
|
||||||
|
flexDirection(YGFlexDirectionColumn),
|
||||||
|
justifyContent(YGJustifyFlexStart),
|
||||||
|
alignContent(YGAlignFlexStart),
|
||||||
|
alignItems(YGAlignStretch),
|
||||||
|
alignSelf(YGAlignAuto),
|
||||||
|
positionType(YGPositionTypeRelative),
|
||||||
|
flexWrap(YGWrapNoWrap),
|
||||||
|
overflow(YGOverflowVisible),
|
||||||
|
display(YGDisplayFlex) {}
|
||||||
bool operator==(const YGStyle& style);
|
bool operator==(const YGStyle& style);
|
||||||
|
|
||||||
bool operator!=(YGStyle style) {
|
bool operator!=(YGStyle style) {
|
||||||
|
Reference in New Issue
Block a user