mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ints: Add support for mag(int32_t) and mag(int64_t)
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1817
This commit is contained in:
@ -136,6 +136,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline int32_t mag(const int32_t l)
|
||||||
|
{
|
||||||
|
return ::abs(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -127,6 +127,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline int64_t mag(const int64_t l)
|
||||||
|
{
|
||||||
|
return ::labs(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -36,15 +36,6 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline label mag(const label l)
|
|
||||||
{
|
|
||||||
#if WM_LABEL_SIZE == 32
|
|
||||||
return ::abs(l);
|
|
||||||
#elif WM_LABEL_SIZE == 64
|
|
||||||
return ::labs(l);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
inline label sign(const label s)
|
inline label sign(const label s)
|
||||||
{
|
{
|
||||||
return (s >= 0)? 1: -1;
|
return (s >= 0)? 1: -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user