Skip to content

Commit d4399c5

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Don't enable ordinalCount() or bitCount() for bitset enums
Summary: Bitfield enums are not sequential, so use of these functions on these enums would be invalid. I looked at whether we could trivially move `bitCount` to template based on `ordinalCount`. `bitCount` must be constexpr, since we use it directly as a bit-field size constant. `log2` and `ceil` to be constexpr, which isn't here until C++ 26. Reviewed By: javache Differential Revision: D51518899 fbshipit-source-id: 256f15bbed517be6f90bf43baa43ce96e9259a71
1 parent 414357a commit d4399c5

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ enum class Errata : uint32_t {
2626

2727
YG_DEFINE_ENUM_FLAG_OPERATORS(Errata)
2828

29-
template <>
30-
constexpr inline int32_t ordinalCount<Errata>() {
31-
return 6;
32-
}
33-
34-
template <>
35-
constexpr inline int32_t bitCount<Errata>() {
36-
return 3;
37-
}
38-
3929
constexpr inline Errata scopedEnum(YGErrata unscoped) {
4030
return static_cast<Errata>(unscoped);
4131
}

packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ enum class PrintOptions : uint32_t {
2323

2424
YG_DEFINE_ENUM_FLAG_OPERATORS(PrintOptions)
2525

26-
template <>
27-
constexpr inline int32_t ordinalCount<PrintOptions>() {
28-
return 3;
29-
}
30-
31-
template <>
32-
constexpr inline int32_t bitCount<PrintOptions>() {
33-
return 2;
34-
}
35-
3626
constexpr inline PrintOptions scopedEnum(YGPrintOptions unscoped) {
3727
return static_cast<PrintOptions>(unscoped);
3828
}

0 commit comments

Comments
 (0)