Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation on older g++ using enum instead of constexpr #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions libeft.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,17 @@ private:
// ** Split

// Splitting factor used by split
template<class Real> constexpr const Real splitFactor = 0. / 0.; // NaN
template<class Real> struct splitFactor {};

// Double precision: ((2^27)+1), where 27 = sup(53/2)
template<> constexpr const double splitFactor<double> = 134217729;
template<> struct splitFactor<double> {
enum { value = 134217729 };
};

// Single precision: ((2^12)+1), where 12 = 24/2
template<> constexpr const float splitFactor<float> = 4097;
template<> struct splitFactor<float> {
enum { value = 4097 };
};

// a = x + y
// x = hi(a)
Expand All @@ -185,7 +189,7 @@ static inline void split(const Intrinsic<Real>& ia, Intrinsic<Real>& ix, Intrins
typedef const Intrinsic<Real> I;

stopInstr();
I ic = I(EFT::splitFactor<Real>) * ia;
I ic = I(EFT::splitFactor<Real>::value) * ia;
ix = ic - (ic-ia);
iy = ia - ix;
startInstr();
Expand Down