Workaround using C's abs on Linux

math.h is indirectly included, making abs return double on Linux.
This commit is contained in:
Campbell Barton 2016-06-30 10:41:38 +10:00
parent b45a54792d
commit b130eca2da

View file

@ -442,6 +442,15 @@ void ParsedPli::setMaxThickness(double maxThickness) {
imp->m_maxThickness = maxThickness;
};
/* indirect inclusion of <math.h> causes 'abs' to return double on Linux */
#ifdef LINUX
template <typename T>
T abs_workaround(T a) {
return (a > 0) ? a : -a;
}
#define abs abs_workaround
#endif
/*=====================================================================*/
static inline UCHAR complement1(char val, bool isNegative = false) {
@ -472,6 +481,10 @@ static inline short complement2(USHORT val) {
return (val & 0x8000) ? -(val & 0x7fff) : (val & 0x7fff);
}
#ifdef LINUX
#undef abs
#endif
/*=====================================================================*/
ParsedPliImp::ParsedPliImp()