diff --git a/src/double.h b/src/double.h index b0a2ecf05e..65964045e2 100644 --- a/src/double.h +++ b/src/double.h @@ -5,6 +5,7 @@ #ifndef V8_DOUBLE_H_ #define V8_DOUBLE_H_ +#include "src/base/macros.h" #include "src/diy-fp.h" namespace v8 { @@ -17,13 +18,16 @@ inline double uint64_to_double(uint64_t d64) { return bit_cast(d64); } // Helper functions for doubles. class Double { public: - static const uint64_t kSignMask = V8_2PART_UINT64_C(0x80000000, 00000000); - static const uint64_t kExponentMask = V8_2PART_UINT64_C(0x7FF00000, 00000000); - static const uint64_t kSignificandMask = + static constexpr uint64_t kSignMask = V8_2PART_UINT64_C(0x80000000, 00000000); + static constexpr uint64_t kExponentMask = + V8_2PART_UINT64_C(0x7FF00000, 00000000); + static constexpr uint64_t kSignificandMask = V8_2PART_UINT64_C(0x000FFFFF, FFFFFFFF); - static const uint64_t kHiddenBit = V8_2PART_UINT64_C(0x00100000, 00000000); - static const int kPhysicalSignificandSize = 52; // Excludes the hidden bit. - static const int kSignificandSize = 53; + static constexpr uint64_t kHiddenBit = + V8_2PART_UINT64_C(0x00100000, 00000000); + static constexpr int kPhysicalSignificandSize = + 52; // Excludes the hidden bit. + static constexpr int kSignificandSize = 53; Double() : d64_(0) {} explicit Double(double d) : d64_(double_to_uint64(d)) {} @@ -169,10 +173,10 @@ class Double { } private: - static const int kExponentBias = 0x3FF + kPhysicalSignificandSize; - static const int kDenormalExponent = -kExponentBias + 1; - static const int kMaxExponent = 0x7FF - kExponentBias; - static const uint64_t kInfinity = V8_2PART_UINT64_C(0x7FF00000, 00000000); + static constexpr int kExponentBias = 0x3FF + kPhysicalSignificandSize; + static constexpr int kDenormalExponent = -kExponentBias + 1; + static constexpr int kMaxExponent = 0x7FF - kExponentBias; + static constexpr uint64_t kInfinity = V8_2PART_UINT64_C(0x7FF00000, 00000000); // The field d64_ is not marked as const to permit the usage of the copy // constructor. diff --git a/tools/generate-header-include-checks.py b/tools/generate-header-include-checks.py index 5f7e97fe73..20c9d28672 100755 --- a/tools/generate-header-include-checks.py +++ b/tools/generate-header-include-checks.py @@ -48,7 +48,6 @@ AUTO_EXCLUDE = [ 'src/debug/debug-scopes.h', 'src/debug/debug-stack-trace-iterator.h', 'src/deoptimizer.h', - 'src/double.h', 'src/elements.h', 'src/elements-inl.h', 'src/field-type.h',