diff options
author | Antonio Sanchez <cantonios@google.com> | 2020-12-11 14:34:31 -0800 |
---|---|---|
committer | Antonio Sanchez <cantonios@google.com> | 2020-12-11 14:34:31 -0800 |
commit | c6efc4e0ba4b9acb8f99e6e976d4853bedc21db5 (patch) | |
tree | 2324384da59139bc1d91f25e3283d6b5417b046e /Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | |
parent | e82722a4a7d69c31155c0de9ccee2c955323b620 (diff) |
Replace M_LOG2E and M_LN2 with custom macros.
For these to exist we would need to define `_USE_MATH_DEFINES` before
`cmath` or `math.h` is first included. However, we don't
control the include order for projects outside Eigen, so even defining
the macro in `Eigen/Core` does not fix the issue for projects that
end up including `<cmath>` before Eigen does (explicitly or transitively).
To fix this, we define `EIGEN_LOG2E` and `EIGEN_LN2` ourselves.
Diffstat (limited to 'Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h')
-rw-r--r-- | Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 45cc780f1..34e2cb1e7 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -132,10 +132,10 @@ Packet plog_impl_float(const Packet _x) // Add the logarithm of the exponent back to the result of the interpolation. if (base2) { - const Packet cst_log2e = pset1<Packet>(static_cast<float>(M_LOG2E)); + const Packet cst_log2e = pset1<Packet>(static_cast<float>(EIGEN_LOG2E)); x = pmadd(x, cst_log2e, e); } else { - const Packet cst_ln2 = pset1<Packet>(static_cast<float>(M_LN2)); + const Packet cst_ln2 = pset1<Packet>(static_cast<float>(EIGEN_LN2)); x = pmadd(e, cst_ln2, x); } @@ -253,10 +253,10 @@ Packet plog_impl_double(const Packet _x) // Add the logarithm of the exponent back to the result of the interpolation. if (base2) { - const Packet cst_log2e = pset1<Packet>(M_LOG2E); + const Packet cst_log2e = pset1<Packet>(EIGEN_LOG2E); x = pmadd(x, cst_log2e, e); } else { - const Packet cst_ln2 = pset1<Packet>(M_LN2); + const Packet cst_ln2 = pset1<Packet>(EIGEN_LN2); x = pmadd(e, cst_ln2, x); } |