core: replace #define'd HP_MAX_64 with static constexpr.
This commit is contained in:
committed by
Peter Barnes
parent
9621afd8f2
commit
92173503ec
@@ -58,22 +58,11 @@ class int64x64_t
|
||||
static const uint128_t HP128_MASK_HI_BIT = (((int128_t)1) << 127);
|
||||
/// Mask for fraction part.
|
||||
static const uint64_t HP_MASK_LO = 0xffffffffffffffffULL;
|
||||
/**
|
||||
* Floating point value of HP_MASK_LO + 1.
|
||||
* We really want:
|
||||
* \code
|
||||
* static const long double HP_MAX_64 = std:pow (2.0L, 64);
|
||||
* \endcode
|
||||
* but we can't call functions in const definitions.
|
||||
*
|
||||
* We could make this a static and initialize in int64x64-128.cc or
|
||||
* int64x64.cc, but this requires handling static initialization order
|
||||
* when most of the implementation is inline. Instead, we resort to
|
||||
* this define.
|
||||
*/
|
||||
#define HP_MAX_64 (std::pow(2.0L, 64))
|
||||
|
||||
public:
|
||||
/// Floating point value of HP_MASK_LO + 1.
|
||||
static constexpr long double HP_MAX_64 = (static_cast<uint64_t>(1) << 63) * 2.0L;
|
||||
|
||||
/**
|
||||
* Type tag for the underlying implementation.
|
||||
*
|
||||
|
||||
@@ -44,21 +44,11 @@ class int64x64_t
|
||||
static const uint64_t HPCAIRO_MASK_HI_BIT = (((uint64_t)1) << 63);
|
||||
/// Mask for fraction part
|
||||
static const uint64_t HP_MASK_LO = 0xffffffffffffffffULL;
|
||||
/**
|
||||
* Floating point value of HP_MASK_LO + 1
|
||||
* We really want:
|
||||
* \code
|
||||
* static const long double HP_MAX_64 = std:pow (2.0L, 64);
|
||||
* \endcode
|
||||
* but we can't call functions in const definitions,
|
||||
* We could make this a static and initialize in int64x64-cairo.cc or
|
||||
* int64x64.cc, but this requires handling static initialization order
|
||||
* when most of the implementation is inline. Instead, we resort to
|
||||
* this define.
|
||||
*/
|
||||
#define HP_MAX_64 (std::pow(2.0L, 64))
|
||||
|
||||
public:
|
||||
/// Floating point value of HP_MASK_LO + 1
|
||||
static constexpr long double HP_MAX_64 = (static_cast<uint64_t>(1) << 63) * 2.0L;
|
||||
|
||||
/**
|
||||
* Type tag for the underlying implementation.
|
||||
*
|
||||
|
||||
@@ -43,21 +43,11 @@ class int64x64_t
|
||||
{
|
||||
/// Mask for fraction part
|
||||
static const uint64_t HP_MASK_LO = 0xffffffffffffffffULL;
|
||||
/**
|
||||
* Floating point value of HP_MASK_LO + 1
|
||||
* We really want:
|
||||
* \code
|
||||
* static const long double HP_MAX_64 = std:pow (2.0L, 64);
|
||||
* \endcode
|
||||
* but we can't call functions in const definitions,
|
||||
* We could make this a static and initialize in int64x64-double.cc or
|
||||
* int64x64.cc, but this requires handling static initialization order
|
||||
* when most of the implementation is inline. Instead, we resort to
|
||||
* this define.
|
||||
*/
|
||||
#define HP_MAX_64 (std::pow(2.0L, 64))
|
||||
|
||||
public:
|
||||
/// Floating point value of HP_MASK_LO + 1
|
||||
static constexpr long double HP_MAX_64 = (static_cast<uint64_t>(1) << 63) * 2.0L;
|
||||
|
||||
/**
|
||||
* Type tag for the underlying implementation.
|
||||
*
|
||||
|
||||
@@ -182,7 +182,8 @@ Int64x64HiLoTestCase::DoRun()
|
||||
if (int64x64_t::implementation == int64x64_t::ld_impl)
|
||||
{
|
||||
// Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1
|
||||
low = static_cast<uint64_t>(HP_MAX_64 * std::numeric_limits<long double>::epsilon());
|
||||
low = static_cast<uint64_t>(int64x64_t::HP_MAX_64 *
|
||||
std::numeric_limits<long double>::epsilon());
|
||||
}
|
||||
|
||||
Check(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user