Remove enum count macros
Summary: @public Removes all `YG...Count` macros for enums and replaces them with `facebook::yoga::enums::count<YG...>()`. This removes the need to manually maintain enum counts. Same as D13597449, working around a defect in clang < 3.9 Reviewed By: amir-shalem Differential Revision: D13634622 fbshipit-source-id: 344dc70e167b0caf746fe396cedd200f54e52219
This commit is contained in:
committed by
Facebook Github Bot
parent
866bf101b2
commit
4840495d3f
@@ -105,7 +105,7 @@ bool YGFloatIsUndefined(const float value) {
|
||||
}
|
||||
|
||||
detail::CompactValue YGComputedEdgeValue(
|
||||
const facebook::yoga::detail::Values<YGEdgeCount>& edges,
|
||||
const YGStyle::Edges& edges,
|
||||
YGEdge edge,
|
||||
detail::CompactValue defaultValue) {
|
||||
if (!edges[edge].isUndefined()) {
|
||||
@@ -3546,14 +3546,12 @@ static const char* YGSpacer(const unsigned long level) {
|
||||
static const char* YGMeasureModeName(
|
||||
const YGMeasureMode mode,
|
||||
const bool performLayout) {
|
||||
const char* kMeasureModeNames[YGMeasureModeCount] = {
|
||||
"UNDEFINED", "EXACTLY", "AT_MOST"};
|
||||
const char* kLayoutModeNames[YGMeasureModeCount] = {"LAY_UNDEFINED",
|
||||
"LAY_EXACTLY",
|
||||
"LAY_AT_"
|
||||
"MOST"};
|
||||
constexpr auto N = enums::count<YGMeasureMode>();
|
||||
const char* kMeasureModeNames[N] = {"UNDEFINED", "EXACTLY", "AT_MOST"};
|
||||
const char* kLayoutModeNames[N] = {
|
||||
"LAY_UNDEFINED", "LAY_EXACTLY", "LAY_AT_MOST"};
|
||||
|
||||
if (mode >= YGMeasureModeCount) {
|
||||
if (mode >= N) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user