diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGMacros.h b/packages/react-native/ReactCommon/yoga/yoga/YGMacros.h index 6460297a3d1684..6d1becce77b53d 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGMacros.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGMacros.h @@ -49,21 +49,21 @@ #ifdef __cplusplus #define YG_DEFINE_ENUM_FLAG_OPERATORS(name) \ extern "C++" { \ - constexpr inline name operator~(name a) { \ + constexpr name operator~(name a) { \ return static_cast( \ ~static_cast::type>(a)); \ } \ - constexpr inline name operator|(name a, name b) { \ + constexpr name operator|(name a, name b) { \ return static_cast( \ static_cast::type>(a) | \ static_cast::type>(b)); \ } \ - constexpr inline name operator&(name a, name b) { \ + constexpr name operator&(name a, name b) { \ return static_cast( \ static_cast::type>(a) & \ static_cast::type>(b)); \ } \ - constexpr inline name operator^(name a, name b) { \ + constexpr name operator^(name a, name b) { \ return static_cast( \ static_cast::type>(a) ^ \ static_cast::type>(b)); \ diff --git a/packages/react-native/ReactCommon/yoga/yoga/bits/BitCast.h b/packages/react-native/ReactCommon/yoga/yoga/bits/BitCast.h deleted file mode 100644 index 13fb0e41f2d39b..00000000000000 --- a/packages/react-native/ReactCommon/yoga/yoga/bits/BitCast.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -namespace facebook::yoga { - -// Polyfill for std::bit_cast() from C++20, to allow safe type punning -// https://en.cppreference.com/w/cpp/numeric/bit_cast -// TODO: Remove when we upgrade to NDK 26+ -template -std::enable_if_t< - sizeof(To) == sizeof(From) && std::is_trivially_copyable_v && - std::is_trivially_copyable_v && - std::is_trivially_constructible_v, - To> -bit_cast(const From& src) noexcept { - To dst; - std::memcpy(&dst, &src, sizeof(To)); - return dst; -} - -} // namespace facebook::yoga diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Align.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Align.h index 67777fc31b4545..3896fe2b8b1d82 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Align.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Align.h @@ -28,20 +28,15 @@ enum class Align : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 9; -} - -template <> -constexpr inline int32_t bitCount() { - return 4; -} +} -constexpr inline Align scopedEnum(YGAlign unscoped) { +constexpr Align scopedEnum(YGAlign unscoped) { return static_cast(unscoped); } -constexpr inline YGAlign unscopedEnum(Align scoped) { +constexpr YGAlign unscopedEnum(Align scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Dimension.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Dimension.h index 2274a980a516ce..965901525ba8c6 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Dimension.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Dimension.h @@ -21,20 +21,15 @@ enum class Dimension : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 2; -} - -template <> -constexpr inline int32_t bitCount() { - return 1; -} +} -constexpr inline Dimension scopedEnum(YGDimension unscoped) { +constexpr Dimension scopedEnum(YGDimension unscoped) { return static_cast(unscoped); } -constexpr inline YGDimension unscopedEnum(Dimension scoped) { +constexpr YGDimension unscopedEnum(Dimension scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Direction.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Direction.h index 1b5e19c93c3ad2..5bbabaecde5a95 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Direction.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Direction.h @@ -22,20 +22,15 @@ enum class Direction : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 3; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline Direction scopedEnum(YGDirection unscoped) { +constexpr Direction scopedEnum(YGDirection unscoped) { return static_cast(unscoped); } -constexpr inline YGDirection unscopedEnum(Direction scoped) { +constexpr YGDirection unscopedEnum(Direction scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Display.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Display.h index c1d8c7a82e5397..418ebc1dcd528c 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Display.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Display.h @@ -21,20 +21,15 @@ enum class Display : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 2; -} - -template <> -constexpr inline int32_t bitCount() { - return 1; -} +} -constexpr inline Display scopedEnum(YGDisplay unscoped) { +constexpr Display scopedEnum(YGDisplay unscoped) { return static_cast(unscoped); } -constexpr inline YGDisplay unscopedEnum(Display scoped) { +constexpr YGDisplay unscopedEnum(Display scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Edge.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Edge.h index d6d2b0ee663f20..3ab6a33faf182e 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Edge.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Edge.h @@ -28,20 +28,15 @@ enum class Edge : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 9; -} - -template <> -constexpr inline int32_t bitCount() { - return 4; -} +} -constexpr inline Edge scopedEnum(YGEdge unscoped) { +constexpr Edge scopedEnum(YGEdge unscoped) { return static_cast(unscoped); } -constexpr inline YGEdge unscopedEnum(Edge scoped) { +constexpr YGEdge unscopedEnum(Edge scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h index 5bda0c0b9c7b57..e97b66c3e79952 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Errata.h @@ -27,11 +27,11 @@ enum class Errata : uint32_t { YG_DEFINE_ENUM_FLAG_OPERATORS(Errata) -constexpr inline Errata scopedEnum(YGErrata unscoped) { +constexpr Errata scopedEnum(YGErrata unscoped) { return static_cast(unscoped); } -constexpr inline YGErrata unscopedEnum(Errata scoped) { +constexpr YGErrata unscopedEnum(Errata scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/ExperimentalFeature.h b/packages/react-native/ReactCommon/yoga/yoga/enums/ExperimentalFeature.h index 6ed358155b0c87..4c366fb43edb14 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/ExperimentalFeature.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/ExperimentalFeature.h @@ -21,20 +21,15 @@ enum class ExperimentalFeature : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 2; -} - -template <> -constexpr inline int32_t bitCount() { - return 1; -} +} -constexpr inline ExperimentalFeature scopedEnum(YGExperimentalFeature unscoped) { +constexpr ExperimentalFeature scopedEnum(YGExperimentalFeature unscoped) { return static_cast(unscoped); } -constexpr inline YGExperimentalFeature unscopedEnum(ExperimentalFeature scoped) { +constexpr YGExperimentalFeature unscopedEnum(ExperimentalFeature scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/FlexDirection.h b/packages/react-native/ReactCommon/yoga/yoga/enums/FlexDirection.h index 45f6497ca45230..d2d3f6105d5e7c 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/FlexDirection.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/FlexDirection.h @@ -23,20 +23,15 @@ enum class FlexDirection : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 4; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline FlexDirection scopedEnum(YGFlexDirection unscoped) { +constexpr FlexDirection scopedEnum(YGFlexDirection unscoped) { return static_cast(unscoped); } -constexpr inline YGFlexDirection unscopedEnum(FlexDirection scoped) { +constexpr YGFlexDirection unscopedEnum(FlexDirection scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Gutter.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Gutter.h index 5c0f4a254e5f6b..f16bbbcdf452ff 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Gutter.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Gutter.h @@ -22,20 +22,15 @@ enum class Gutter : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 3; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline Gutter scopedEnum(YGGutter unscoped) { +constexpr Gutter scopedEnum(YGGutter unscoped) { return static_cast(unscoped); } -constexpr inline YGGutter unscopedEnum(Gutter scoped) { +constexpr YGGutter unscopedEnum(Gutter scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Justify.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Justify.h index 870a3cb2a70029..255baa6e27d887 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Justify.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Justify.h @@ -25,20 +25,15 @@ enum class Justify : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 6; -} - -template <> -constexpr inline int32_t bitCount() { - return 3; -} +} -constexpr inline Justify scopedEnum(YGJustify unscoped) { +constexpr Justify scopedEnum(YGJustify unscoped) { return static_cast(unscoped); } -constexpr inline YGJustify unscopedEnum(Justify scoped) { +constexpr YGJustify unscopedEnum(Justify scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/LogLevel.h b/packages/react-native/ReactCommon/yoga/yoga/enums/LogLevel.h index 45cac9fe3974ec..d4b2c36019fb7c 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/LogLevel.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/LogLevel.h @@ -25,20 +25,15 @@ enum class LogLevel : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 6; -} - -template <> -constexpr inline int32_t bitCount() { - return 3; -} +} -constexpr inline LogLevel scopedEnum(YGLogLevel unscoped) { +constexpr LogLevel scopedEnum(YGLogLevel unscoped) { return static_cast(unscoped); } -constexpr inline YGLogLevel unscopedEnum(LogLevel scoped) { +constexpr YGLogLevel unscopedEnum(LogLevel scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/MeasureMode.h b/packages/react-native/ReactCommon/yoga/yoga/enums/MeasureMode.h index 80fbcc599f4c90..39e2102fff0f76 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/MeasureMode.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/MeasureMode.h @@ -22,20 +22,15 @@ enum class MeasureMode : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 3; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline MeasureMode scopedEnum(YGMeasureMode unscoped) { +constexpr MeasureMode scopedEnum(YGMeasureMode unscoped) { return static_cast(unscoped); } -constexpr inline YGMeasureMode unscopedEnum(MeasureMode scoped) { +constexpr YGMeasureMode unscopedEnum(MeasureMode scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/NodeType.h b/packages/react-native/ReactCommon/yoga/yoga/enums/NodeType.h index 782b163c2e110d..dc881be831f808 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/NodeType.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/NodeType.h @@ -21,20 +21,15 @@ enum class NodeType : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 2; -} - -template <> -constexpr inline int32_t bitCount() { - return 1; -} +} -constexpr inline NodeType scopedEnum(YGNodeType unscoped) { +constexpr NodeType scopedEnum(YGNodeType unscoped) { return static_cast(unscoped); } -constexpr inline YGNodeType unscopedEnum(NodeType scoped) { +constexpr YGNodeType unscopedEnum(NodeType scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Overflow.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Overflow.h index 1d29103e62f790..20901b02c05a4c 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Overflow.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Overflow.h @@ -22,20 +22,15 @@ enum class Overflow : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 3; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline Overflow scopedEnum(YGOverflow unscoped) { +constexpr Overflow scopedEnum(YGOverflow unscoped) { return static_cast(unscoped); } -constexpr inline YGOverflow unscopedEnum(Overflow scoped) { +constexpr YGOverflow unscopedEnum(Overflow scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/PositionType.h b/packages/react-native/ReactCommon/yoga/yoga/enums/PositionType.h index bde2b1896fbe37..8a552aacbac9f6 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/PositionType.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/PositionType.h @@ -22,20 +22,15 @@ enum class PositionType : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 3; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline PositionType scopedEnum(YGPositionType unscoped) { +constexpr PositionType scopedEnum(YGPositionType unscoped) { return static_cast(unscoped); } -constexpr inline YGPositionType unscopedEnum(PositionType scoped) { +constexpr YGPositionType unscopedEnum(PositionType scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h b/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h index 90d0043c74a4dd..5970bafb47aa0e 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/PrintOptions.h @@ -23,11 +23,11 @@ enum class PrintOptions : uint32_t { YG_DEFINE_ENUM_FLAG_OPERATORS(PrintOptions) -constexpr inline PrintOptions scopedEnum(YGPrintOptions unscoped) { +constexpr PrintOptions scopedEnum(YGPrintOptions unscoped) { return static_cast(unscoped); } -constexpr inline YGPrintOptions unscopedEnum(PrintOptions scoped) { +constexpr YGPrintOptions unscopedEnum(PrintOptions scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Unit.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Unit.h index 36efe95aaf654a..57bd1969708361 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Unit.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Unit.h @@ -23,20 +23,15 @@ enum class Unit : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 4; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline Unit scopedEnum(YGUnit unscoped) { +constexpr Unit scopedEnum(YGUnit unscoped) { return static_cast(unscoped); } -constexpr inline YGUnit unscopedEnum(Unit scoped) { +constexpr YGUnit unscopedEnum(Unit scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/Wrap.h b/packages/react-native/ReactCommon/yoga/yoga/enums/Wrap.h index ae380a4448d828..96552b7b2a7b8b 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/Wrap.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/Wrap.h @@ -22,20 +22,15 @@ enum class Wrap : uint8_t { }; template <> -constexpr inline int32_t ordinalCount() { +constexpr int32_t ordinalCount() { return 3; -} - -template <> -constexpr inline int32_t bitCount() { - return 2; -} +} -constexpr inline Wrap scopedEnum(YGWrap unscoped) { +constexpr Wrap scopedEnum(YGWrap unscoped) { return static_cast(unscoped); } -constexpr inline YGWrap unscopedEnum(Wrap scoped) { +constexpr YGWrap unscopedEnum(Wrap scoped) { return static_cast(scoped); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/enums/YogaEnums.h b/packages/react-native/ReactCommon/yoga/yoga/enums/YogaEnums.h index a3e1191de11eae..de446621d51397 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/enums/YogaEnums.h +++ b/packages/react-native/ReactCommon/yoga/yoga/enums/YogaEnums.h @@ -7,25 +7,44 @@ #pragma once +#include #include #include namespace facebook::yoga { +/** + * Concept for any enum/enum class + */ template -constexpr inline int32_t ordinalCount(); +concept Enumeration = std::is_enum_v; /** - * Count of bits needed to represent every ordinal + * Count of ordinals in a Yoga enum which is sequential + */ +template +constexpr int32_t ordinalCount(); + +/** + * Concept for a yoga enum which is sequential */ template -constexpr inline int32_t bitCount(); +concept HasOrdinality = (ordinalCount() > 0); + +/** + * Count of bits needed to represent every ordinal + */ +template +constexpr int32_t bitCount() { + return std::bit_width( + static_cast>(ordinalCount() - 1)); +} /** * Polyfill of C++ 23 to_underlying() * https://en.cppreference.com/w/cpp/utility/to_underlying */ -constexpr auto to_underlying(auto e) noexcept { +constexpr auto to_underlying(Enumeration auto e) noexcept { return static_cast>(e); } @@ -33,7 +52,7 @@ constexpr auto to_underlying(auto e) noexcept { * Convenience function to iterate through every value in a Yoga enum as part of * a range-based for loop. */ -template +template auto ordinals() { struct Iterator { EnumT e{}; diff --git a/packages/react-native/ReactCommon/yoga/yoga/numeric/Comparison.h b/packages/react-native/ReactCommon/yoga/yoga/numeric/Comparison.h index 3bf1037b9cc376..729589b934a8a2 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/numeric/Comparison.h +++ b/packages/react-native/ReactCommon/yoga/yoga/numeric/Comparison.h @@ -10,27 +10,32 @@ #include #include #include +#include #include namespace facebook::yoga { -constexpr bool isUndefined(auto value) { +constexpr bool isUndefined(std::floating_point auto value) { return value != value; } -constexpr bool isDefined(auto value) { +constexpr bool isDefined(std::floating_point auto value) { return !isUndefined(value); } -constexpr auto maxOrDefined(auto a, auto b) { +constexpr auto maxOrDefined( + std::floating_point auto a, + std::floating_point auto b) { if (yoga::isDefined(a) && yoga::isDefined(b)) { return std::max(a, b); } return yoga::isUndefined(a) ? b : a; } -constexpr auto minOrDefined(auto a, auto b) { +constexpr auto minOrDefined( + std::floating_point auto a, + std::floating_point auto b) { if (yoga::isDefined(a) && yoga::isDefined(b)) { return std::min(a, b); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/style/CompactValue.h b/packages/react-native/ReactCommon/yoga/yoga/style/CompactValue.h index c32dd9276f1ede..d7884e1d6f5dfd 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/style/CompactValue.h +++ b/packages/react-native/ReactCommon/yoga/yoga/style/CompactValue.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -14,7 +15,6 @@ #include #include -#include #include static_assert( @@ -69,7 +69,7 @@ class YG_EXPORT CompactValue { } uint32_t unitBit = Unit == YGUnitPercent ? PERCENT_BIT : 0; - auto data = yoga::bit_cast(value); + auto data = std::bit_cast(value); data -= BIAS; data |= unitBit; return {data}; @@ -112,7 +112,7 @@ class YG_EXPORT CompactValue { return YGValue{0.0f, YGUnitPercent}; } - if (std::isnan(yoga::bit_cast(repr_))) { + if (std::isnan(std::bit_cast(repr_))) { return YGValueUndefined; } @@ -121,14 +121,14 @@ class YG_EXPORT CompactValue { data += BIAS; return YGValue{ - yoga::bit_cast(data), + std::bit_cast(data), repr_ & 0x40000000 ? YGUnitPercent : YGUnitPoint}; } bool isUndefined() const noexcept { return ( repr_ != AUTO_BITS && repr_ != ZERO_BITS_POINT && - repr_ != ZERO_BITS_PERCENT && std::isnan(yoga::bit_cast(repr_))); + repr_ != ZERO_BITS_PERCENT && std::isnan(std::bit_cast(repr_))); } bool isDefined() const noexcept {