Skip to content
Snippets Groups Projects
Commit bb2209e7 authored by Uwe Woessner's avatar Uwe Woessner
Browse files

oops missed constAbs in commonHelper, here it is

parent 4bb55ceb
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,13 @@
#include "math.h"
#include "common/globalDefinitions.h"
/* std::abs is not constexpr (at least up to C++20) other than gcc, MSVC sticks to this standard.
this is a constexpr version of abs which should work with all compilers*/
inline constexpr double constAbs(double a) noexcept
{
return (a >= 0) ? a : -a;
}
//-----------------------------------------------------------------------------
//! @brief defines common helper functions like conversion from and to enums.
//-----------------------------------------------------------------------------
......@@ -26,7 +33,7 @@ static constexpr double EPSILON = 0.001; //!Treat values smaller than epsilon as
[[maybe_unused]] static inline constexpr bool DoubleEquality(double value1, double value2, double epsilon = EPSILON)
{
return myAbs(value1 - value2) <= epsilon;
return constAbs(value1 - value2) <= epsilon;
}
//! Returns the same angle but within the range [-PI, PI]
......
......@@ -18,16 +18,11 @@
#include <cmath>
#include "common/opExport.h"
#include "common/globalDefinitions.h"
#include "common/commonHelper.h"
namespace Common {
/* std::abs is not constexpr (at least up to C++20) other than gcc, MSVC sticks to this standard.
this is a constexpr version of abs which should work with all compilers*/
inline constexpr double constAbs(double a) noexcept
{
return (a >= 0) ? a : -a;
}
/*!
* class for 2d vectors in cartesian coordinate system
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment