diff --git a/libs/main/core/pibase.h b/libs/main/core/pibase.h index 82b95935..593a0dfa 100644 --- a/libs/main/core/pibase.h +++ b/libs/main/core/pibase.h @@ -358,7 +358,7 @@ inline bool piCompareBinary(const void * f, const void * s, size_t size) { * * Example: * \snippet piincludes.cpp round */ -template inline int piRound(const T & v) {return int(v >= T(0.) ? v + T(0.5) : v - T(0.5));} +template inline constexpr int piRound(const T & v) {return int(v >= T(0.) ? v + T(0.5) : v - T(0.5));} /*! \brief Templated function return floor of float falue * \details Floor is the largest integer that is not greater than value \n @@ -368,7 +368,7 @@ template inline int piRound(const T & v) {return int(v >= T(0.) ? v * * Example: * \snippet piincludes.cpp floor */ -template inline int piFloor(const T & v) {return v < T(0) ? int(v) - 1 : int(v);} +template inline constexpr int piFloor(const T & v) {return v < T(0) ? int(v) - 1 : int(v);} /*! \brief Templated function return ceil of float falue * \details Ceil is the smallest integer that is not less than value \n @@ -378,7 +378,7 @@ template inline int piFloor(const T & v) {return v < T(0) ? int(v) - * * Example: * \snippet piincludes.cpp ceil */ -template inline int piCeil(const T & v) {return v < T(0) ? int(v) : int(v) + 1;} +template inline constexpr int piCeil(const T & v) {return v < T(0) ? int(v) : int(v) + 1;} /*! \brief Templated function return absolute of numeric falue * \details Absolute is the positive or equal 0 value \n @@ -392,7 +392,7 @@ template inline int piCeil(const T & v) {return v < T(0) ? int(v) : * * Example: * \snippet piincludes.cpp abs */ -template inline T piAbs(const T & v) {return (v >= T(0) ? v : -v);} +template inline constexpr T piAbs(const T & v) {return (v >= T(0) ? v : -v);} /*! \brief Templated function return minimum of two values * \details There are some macros: @@ -405,7 +405,7 @@ template inline T piAbs(const T & v) {return (v >= T(0) ? v : -v);} * * Example: * \snippet piincludes.cpp min2 */ -template inline T piMin(const T & f, const T & s) {return ((f > s) ? s : f);} +template inline constexpr T piMin(const T & f, const T & s) {return ((f > s) ? s : f);} /*! \brief Templated function return minimum of tree values * \details There are some macros: @@ -418,7 +418,7 @@ template inline T piMin(const T & f, const T & s) {return ((f > s) ? * * Example: * \snippet piincludes.cpp min3 */ -template inline T piMin(const T & f, const T & s, const T & t) {return ((f < s && f < t) ? f : ((s < t) ? s : t));} +template inline constexpr T piMin(const T & f, const T & s, const T & t) {return ((f < s && f < t) ? f : ((s < t) ? s : t));} /*! \brief Templated function return maximum of two values * \details There are some macros: @@ -431,7 +431,7 @@ template inline T piMin(const T & f, const T & s, const T & t) {retu * * Example: * \snippet piincludes.cpp max2 */ -template inline T piMax(const T & f, const T & s) {return ((f < s) ? s : f);} +template inline constexpr T piMax(const T & f, const T & s) {return ((f < s) ? s : f);} /*! \brief Templated function return maximum of tree values * \details There are some macros: @@ -444,7 +444,7 @@ template inline T piMax(const T & f, const T & s) {return ((f < s) ? * * Example: * \snippet piincludes.cpp max3 */ -template inline T piMax(const T & f, const T & s, const T & t) {return ((f > s && f > t) ? f : ((s > t) ? s : t));} +template inline constexpr T piMax(const T & f, const T & s, const T & t) {return ((f > s && f > t) ? f : ((s > t) ? s : t));} /*! \brief Templated function return clamped value * \details Clamped is the not greater than "max" and not lesser than "min" value \n @@ -458,7 +458,7 @@ template inline T piMax(const T & f, const T & s, const T & t) {retu * * Example: * \snippet piincludes.cpp clamp */ -template inline T piClamp(const T & v, const T & min, const T & max) {return (v > max ? max : (v < min ? min : v));} +template inline constexpr T piClamp(const T & v, const T & min, const T & max) {return (v > max ? max : (v < min ? min : v));} /// Function inverse byte order in memory block inline void piLetobe(void * data, int size) {