Workaround using C's abs on Linux
math.h is indirectly included, making abs return double on Linux.
This commit is contained in:
parent
b45a54792d
commit
b130eca2da
1 changed files with 13 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue