From 3f3e3f2c76c5888762274a43a9ddd56922fa7cc0 Mon Sep 17 00:00:00 2001 From: Transporter Date: Fri, 5 Jan 2024 10:44:50 +0100 Subject: [PATCH] Fix std::min/std::max template types --- modules/core/include/visp3/core/vpMath.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/core/include/visp3/core/vpMath.h b/modules/core/include/visp3/core/vpMath.h index 19fdade01f..75727fbdd1 100644 --- a/modules/core/include/visp3/core/vpMath.h +++ b/modules/core/include/visp3/core/vpMath.h @@ -488,14 +488,14 @@ template <> inline unsigned char vpMath::saturate(char v) // On little endian arch, CHAR_MIN=-127 and CHAR_MAX=128 leading to // (int)(char -127) = -127. if (std::numeric_limits::is_signed) - return static_cast(std::max(static_cast(v), 0)); + return static_cast(std::max(static_cast(v), 0)); else return static_cast(static_cast(v) > SCHAR_MAX ? 0 : v); } template <> inline unsigned char vpMath::saturate(unsigned short v) { - return static_cast(std::min(static_cast(v), static_cast(UCHAR_MAX))); + return static_cast(std::min(static_cast(v), static_cast(UCHAR_MAX))); } template <> inline unsigned char vpMath::saturate(int v) @@ -510,7 +510,7 @@ template <> inline unsigned char vpMath::saturate(short v) template <> inline unsigned char vpMath::saturate(unsigned int v) { - return static_cast(std::min(v, static_cast(UCHAR_MAX))); + return static_cast(std::min(v, static_cast(UCHAR_MAX))); } template <> inline unsigned char vpMath::saturate(float v) @@ -528,12 +528,12 @@ template <> inline unsigned char vpMath::saturate(double v) // char template <> inline char vpMath::saturate(unsigned char v) { - return static_cast(std::min(static_cast(v), SCHAR_MAX)); + return static_cast(std::min(static_cast(v), SCHAR_MAX)); } template <> inline char vpMath::saturate(unsigned short v) { - return static_cast(std::min(static_cast(v), static_cast(SCHAR_MAX))); + return static_cast(std::min(static_cast(v), static_cast(SCHAR_MAX))); } template <> inline char vpMath::saturate(int v) @@ -548,7 +548,7 @@ template <> inline char vpMath::saturate(short v) template <> inline char vpMath::saturate(unsigned int v) { - return static_cast(std::min(v, static_cast(SCHAR_MAX))); + return static_cast(std::min(v, static_cast(SCHAR_MAX))); } template <> inline char vpMath::saturate(float v) @@ -572,14 +572,14 @@ template <> inline unsigned short vpMath::saturate(char v) // On little endian arch, CHAR_MIN=-127 and CHAR_MAX=128 leading to // (int)(char -127) = -127. if (std::numeric_limits::is_signed) - return static_cast(std::max(static_cast(v), 0)); + return static_cast(std::max(static_cast(v), 0)); else return static_cast(static_cast(v) > SCHAR_MAX ? 0 : v); } template <> inline unsigned short vpMath::saturate(short v) { - return static_cast(std::max(static_cast(v), 0)); + return static_cast(std::max(static_cast(v), 0)); } template <> inline unsigned short vpMath::saturate(int v) @@ -589,7 +589,7 @@ template <> inline unsigned short vpMath::saturate(int v) template <> inline unsigned short vpMath::saturate(unsigned int v) { - return static_cast(std::min(v, static_cast(USHRT_MAX))); + return static_cast(std::min(v, static_cast(USHRT_MAX))); } template <> inline unsigned short vpMath::saturate(float v) @@ -607,7 +607,7 @@ template <> inline unsigned short vpMath::saturate(double v) // short template <> inline short vpMath::saturate(unsigned short v) { - return static_cast(std::min(static_cast(v), SHRT_MAX)); + return static_cast(std::min(static_cast(v), SHRT_MAX)); } template <> inline short vpMath::saturate(int v) { @@ -615,7 +615,7 @@ template <> inline short vpMath::saturate(int v) } template <> inline short vpMath::saturate(unsigned int v) { - return static_cast(std::min(v, static_cast(SHRT_MAX))); + return static_cast(std::min(v, static_cast(SHRT_MAX))); } template <> inline short vpMath::saturate(float v) {