From 45f7e7513a86b38ca240bbc796fbf5090a26a0d9 Mon Sep 17 00:00:00 2001 From: Steven French Date: Wed, 17 Apr 2024 00:34:44 +1200 Subject: [PATCH] wrap std::numeric_limits<>::min/max in brackets --- glm/ext/quaternion_exponential.inl | 2 +- glm/ext/scalar_ulp.inl | 10 +++++----- glm/gtc/packing.inl | 8 ++++---- glm/gtc/random.inl | 26 +++++++++++++------------- glm/gtc/ulp.inl | 10 +++++----- glm/gtx/common.inl | 2 +- glm/gtx/compatibility.inl | 4 ++-- glm/gtx/component_wise.inl | 10 +++++----- glm/gtx/float_notmalize.inl | 2 +- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/glm/ext/quaternion_exponential.inl b/glm/ext/quaternion_exponential.inl index 8a9d774b..26c4ab14 100644 --- a/glm/ext/quaternion_exponential.inl +++ b/glm/ext/quaternion_exponential.inl @@ -60,7 +60,7 @@ namespace glm //VectorMagnitude to 0. here; we could use denorm_int() compiling a //project with unsafe maths optimizations might make the comparison //always false, even when VectorMagnitude is 0. - if (VectorMagnitude < std::numeric_limits::min()) { + if (VectorMagnitude < (std::numeric_limits::min)()) { //Equivalent to raising a real number to a power return qua::wxyz(pow(x.w, y), 0, 0, 0); } diff --git a/glm/ext/scalar_ulp.inl b/glm/ext/scalar_ulp.inl index 9858dc05..b0ed37a3 100644 --- a/glm/ext/scalar_ulp.inl +++ b/glm/ext/scalar_ulp.inl @@ -198,7 +198,7 @@ namespace glm GLM_FUNC_QUALIFIER float nextFloat(float x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::max()); + return std::nextafter(x, (std::numeric_limits::max)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafterf(x, FLT_MAX); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) @@ -212,9 +212,9 @@ namespace glm GLM_FUNC_QUALIFIER double nextFloat(double x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::max()); + return std::nextafter(x, (std::numeric_limits::max)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) - return detail::nextafter(x, std::numeric_limits::max()); + return detail::nextafter(x, (std::numeric_limits::max)()); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) return __builtin_nextafter(x, DBL_MAX); # else @@ -237,7 +237,7 @@ namespace glm GLM_FUNC_QUALIFIER float prevFloat(float x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::min()); + return std::nextafter(x, (std::numeric_limits::min)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafterf(x, FLT_MIN); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) @@ -250,7 +250,7 @@ namespace glm GLM_FUNC_QUALIFIER double prevFloat(double x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::min()); + return std::nextafter(x, (std::numeric_limits::min)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return _nextafter(x, DBL_MIN); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 70f80991..e80c2b87 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -687,7 +687,7 @@ namespace detail GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); - return vec(round(clamp(v, static_cast(0), static_cast(1)) * static_cast(std::numeric_limits::max()))); + return vec(round(clamp(v, static_cast(0), static_cast(1)) * static_cast((std::numeric_limits::max)()))); } template @@ -696,7 +696,7 @@ namespace detail GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); - return vec(v) * (static_cast(1) / static_cast(std::numeric_limits::max())); + return vec(v) * (static_cast(1) / static_cast((std::numeric_limits::max)())); } template @@ -705,7 +705,7 @@ namespace detail GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); - return vec(round(clamp(v , static_cast(-1), static_cast(1)) * static_cast(std::numeric_limits::max()))); + return vec(round(clamp(v , static_cast(-1), static_cast(1)) * static_cast((std::numeric_limits::max)()))); } template @@ -714,7 +714,7 @@ namespace detail GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "uintType must be an integer type"); GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "floatType must be a floating point type"); - return clamp(vec(v) * (static_cast(1) / static_cast(std::numeric_limits::max())), static_cast(-1), static_cast(1)); + return clamp(vec(v) * (static_cast(1) / static_cast((std::numeric_limits::max)())), static_cast(-1), static_cast(1)); } GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const& v) diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index 249ec9f9..70070176 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -22,7 +22,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec<1, uint8, P> call() { return vec<1, uint8, P>( - static_cast(std::rand() % std::numeric_limits::max())); + static_cast(std::rand() % (std::numeric_limits::max)())); } }; @@ -32,8 +32,8 @@ namespace detail GLM_FUNC_QUALIFIER static vec<2, uint8, P> call() { return vec<2, uint8, P>( - std::rand() % std::numeric_limits::max(), - std::rand() % std::numeric_limits::max()); + std::rand() % (std::numeric_limits::max)(), + std::rand() % (std::numeric_limits::max)()); } }; @@ -43,9 +43,9 @@ namespace detail GLM_FUNC_QUALIFIER static vec<3, uint8, P> call() { return vec<3, uint8, P>( - std::rand() % std::numeric_limits::max(), - std::rand() % std::numeric_limits::max(), - std::rand() % std::numeric_limits::max()); + std::rand() % (std::numeric_limits::max)(), + std::rand() % (std::numeric_limits::max)(), + std::rand() % (std::numeric_limits::max)()); } }; @@ -55,10 +55,10 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, uint8, P> call() { return vec<4, uint8, P>( - std::rand() % std::numeric_limits::max(), - std::rand() % std::numeric_limits::max(), - std::rand() % std::numeric_limits::max(), - std::rand() % std::numeric_limits::max()); + std::rand() % (std::numeric_limits::max)(), + std::rand() % (std::numeric_limits::max)(), + std::rand() % (std::numeric_limits::max)(), + std::rand() % (std::numeric_limits::max)()); } }; @@ -178,7 +178,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& Min, vec const& Max) { - return vec(compute_rand::call()) / static_cast(std::numeric_limits::max()) * (Max - Min) + Min; + return vec(compute_rand::call()) / static_cast((std::numeric_limits::max)()) * (Max - Min) + Min; } }; @@ -187,7 +187,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& Min, vec const& Max) { - return vec(compute_rand::call()) / static_cast(std::numeric_limits::max()) * (Max - Min) + Min; + return vec(compute_rand::call()) / static_cast((std::numeric_limits::max)()) * (Max - Min) + Min; } }; @@ -196,7 +196,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& Min, vec const& Max) { - return vec(compute_rand::call()) / static_cast(std::numeric_limits::max()) * (Max - Min) + Min; + return vec(compute_rand::call()) / static_cast((std::numeric_limits::max)()) * (Max - Min) + Min; } }; }//namespace detail diff --git a/glm/gtc/ulp.inl b/glm/gtc/ulp.inl index 836c84b4..e4641e93 100644 --- a/glm/gtc/ulp.inl +++ b/glm/gtc/ulp.inl @@ -8,7 +8,7 @@ namespace glm GLM_FUNC_QUALIFIER float next_float(float x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::max()); + return std::nextafter(x, (std::numeric_limits::max)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafterf(x, FLT_MAX); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) @@ -22,9 +22,9 @@ namespace glm GLM_FUNC_QUALIFIER double next_float(double x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::max()); + return std::nextafter(x, (std::numeric_limits::max)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) - return detail::nextafter(x, std::numeric_limits::max()); + return detail::nextafter(x, (std::numeric_limits::max)()); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) return __builtin_nextafter(x, DBL_MAX); # else @@ -47,7 +47,7 @@ namespace glm GLM_FUNC_QUALIFIER float prev_float(float x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::min()); + return std::nextafter(x, (std::numeric_limits::min)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return detail::nextafterf(x, FLT_MIN); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) @@ -60,7 +60,7 @@ namespace glm GLM_FUNC_QUALIFIER double prev_float(double x) { # if GLM_HAS_CXX11_STL - return std::nextafter(x, std::numeric_limits::min()); + return std::nextafter(x, (std::numeric_limits::min)()); # elif((GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))) return _nextafter(x, DBL_MIN); # elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) diff --git a/glm/gtx/common.inl b/glm/gtx/common.inl index 4575b207..90fafc85 100644 --- a/glm/gtx/common.inl +++ b/glm/gtx/common.inl @@ -34,7 +34,7 @@ namespace detail # if GLM_HAS_CXX11_STL return std::fpclassify(x) == FP_SUBNORMAL; # else - return epsilonNotEqual(x, static_cast(0), epsilon()) && std::fabs(x) < std::numeric_limits::min(); + return epsilonNotEqual(x, static_cast(0), epsilon()) && std::fabs(x) < (std::numeric_limits::min)(); # endif } diff --git a/glm/gtx/compatibility.inl b/glm/gtx/compatibility.inl index 1d49496b..63169b96 100644 --- a/glm/gtx/compatibility.inl +++ b/glm/gtx/compatibility.inl @@ -15,9 +15,9 @@ namespace glm return _isfinite(x) != 0; # else if (std::numeric_limits::is_integer || std::denorm_absent == std::numeric_limits::has_denorm) - return std::numeric_limits::min() <= x && std::numeric_limits::max() >= x; + return (std::numeric_limits::min)() <= x && (std::numeric_limits::max)() >= x; else - return -std::numeric_limits::max() <= x && std::numeric_limits::max() >= x; + return -(std::numeric_limits::max)() <= x && (std::numeric_limits::max)() >= x; # endif } diff --git a/glm/gtx/component_wise.inl b/glm/gtx/component_wise.inl index cbbc7d41..076e0e22 100644 --- a/glm/gtx/component_wise.inl +++ b/glm/gtx/component_wise.inl @@ -14,8 +14,8 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& v) { - floatType const Min = static_cast(std::numeric_limits::min()); - floatType const Max = static_cast(std::numeric_limits::max()); + floatType const Min = static_cast((std::numeric_limits::min)()); + floatType const Max = static_cast((std::numeric_limits::max)()); return (vec(v) - Min) / (Max - Min) * static_cast(2) - static_cast(1); } }; @@ -25,7 +25,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& v) { - return vec(v) / static_cast(std::numeric_limits::max()); + return vec(v) / static_cast((std::numeric_limits::max)()); } }; @@ -47,7 +47,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& v) { - floatType const Max = static_cast(std::numeric_limits::max()) + static_cast(0.5); + floatType const Max = static_cast((std::numeric_limits::max)()) + static_cast(0.5); vec const Scaled(v * Max); vec const Result(Scaled - static_cast(0.5)); return Result; @@ -59,7 +59,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& v) { - return vec(vec(v) * static_cast(std::numeric_limits::max())); + return vec(vec(v) * static_cast(((std::numeric_limits::max))())); } }; diff --git a/glm/gtx/float_notmalize.inl b/glm/gtx/float_notmalize.inl index 8cdbc5aa..a2e1bfb6 100644 --- a/glm/gtx/float_notmalize.inl +++ b/glm/gtx/float_notmalize.inl @@ -7,7 +7,7 @@ namespace glm template GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) { - return vec(v) / static_cast(std::numeric_limits::max()); + return vec(v) / static_cast((std::numeric_limits::max)()); } }//namespace glm