From 731c903164dc0bc941f9a4eda6095d35d25fcdba Mon Sep 17 00:00:00 2001 From: Steven French Date: Mon, 19 Aug 2024 15:14:37 +1200 Subject: [PATCH] some more min/max wrappings 2 --- glm/ext/scalar_common.inl | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/glm/ext/scalar_common.inl b/glm/ext/scalar_common.inl index a24db5ff..97edcf51 100644 --- a/glm/ext/scalar_common.inl +++ b/glm/ext/scalar_common.inl @@ -39,33 +39,33 @@ namespace glm # endif template - GLM_FUNC_QUALIFIER T fmin(T a, T b, T c) + GLM_FUNC_QUALIFIER T (fmin)(T a, T b, T c) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'fmin' only accept floating-point input"); if (isnan(a)) - return fmin(b, c); + return (fmin)(b, c); if (isnan(b)) - return fmin(a, c); + return (fmin)(a, c); if (isnan(c)) return min(a, b); - return min(a, b, c); + return (min)(a, b, c); } template - GLM_FUNC_QUALIFIER T fmin(T a, T b, T c, T d) + GLM_FUNC_QUALIFIER T (fmin)(T a, T b, T c, T d) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'fmin' only accept floating-point input"); if (isnan(a)) - return fmin(b, c, d); + return (fmin)(b, c, d); if (isnan(b)) - return min(a, fmin(c, d)); + return (min)(a, (fmin)(c, d)); if (isnan(c)) - return fmin(min(a, b), d); + return (fmin)(min(a, b), d); if (isnan(d)) - return min(a, b, c); - return min(a, b, c, d); + return (min)(a, b, c); + return (min)(a, b, c, d); } @@ -73,44 +73,44 @@ namespace glm using std::fmax; # else template - GLM_FUNC_QUALIFIER T fmax(T a, T b) + GLM_FUNC_QUALIFIER T (fmax)(T a, T b) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'fmax' only accept floating-point input"); if (isnan(a)) return b; - return max(a, b); + return (max)(a, b); } # endif template - GLM_FUNC_QUALIFIER T fmax(T a, T b, T c) + GLM_FUNC_QUALIFIER T (fmax)(T a, T b, T c) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'fmax' only accept floating-point input"); if (isnan(a)) - return fmax(b, c); + return (fmax)(b, c); if (isnan(b)) - return fmax(a, c); + return (fmax)(a, c); if (isnan(c)) - return max(a, b); - return max(a, b, c); + return (max)(a, b); + return (max)(a, b, c); } template - GLM_FUNC_QUALIFIER T fmax(T a, T b, T c, T d) + GLM_FUNC_QUALIFIER T (fmax)(T a, T b, T c, T d) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'fmax' only accept floating-point input"); if (isnan(a)) - return fmax(b, c, d); + return (fmax)(b, c, d); if (isnan(b)) - return max(a, fmax(c, d)); + return (max)(a, (fmax)(c, d)); if (isnan(c)) - return fmax(max(a, b), d); + return (fmax)((max)(a, b), d); if (isnan(d)) - return max(a, b, c); - return max(a, b, c, d); + return (max)(a, b, c); + return (max)(a, b, c, d); } // fclamp @@ -118,7 +118,7 @@ namespace glm GLM_FUNC_QUALIFIER genType fclamp(genType x, genType minVal, genType maxVal) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_FLOAT, "'fclamp' only accept floating-point or integer inputs"); - return fmin(fmax(x, minVal), maxVal); + return fmin((fmax)(x, minVal), maxVal); } template