From 404b2f2c4e5de8e72bac246c65a2c46fedd9ae8d Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Thu, 4 Jan 2024 21:35:18 -0400 Subject: [PATCH] address VS compiler suggestion about constexpr --- src/modules/graphics/wrap_Buffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/graphics/wrap_Buffer.cpp b/src/modules/graphics/wrap_Buffer.cpp index 8f2aebce5..9917358f8 100644 --- a/src/modules/graphics/wrap_Buffer.cpp +++ b/src/modules/graphics/wrap_Buffer.cpp @@ -46,7 +46,7 @@ template static inline size_t writeSNormData(lua_State *L, int startidx, int components, char *data) { auto componentdata = (T *) data; - const auto maxval = std::numeric_limits::max(); + constexpr auto maxval = std::numeric_limits::max(); for (int i = 0; i < components; i++) componentdata[i] = (T) (luax_optnumberclamped(L, startidx + i, -1.0, 1.0, defaultComponents[i]) * maxval); @@ -58,7 +58,7 @@ template static inline size_t writeUNormData(lua_State *L, int startidx, int components, char *data) { auto componentdata = (T *) data; - const auto maxval = std::numeric_limits::max(); + constexpr auto maxval = std::numeric_limits::max(); for (int i = 0; i < components; i++) componentdata[i] = (T) (luax_optnumberclamped01(L, startidx + i, 1.0) * maxval); @@ -145,7 +145,7 @@ template static inline size_t readSNormData(lua_State *L, int components, const char *data) { const auto componentdata = (const T *) data; - const auto maxval = std::numeric_limits::max(); + constexpr auto maxval = std::numeric_limits::max(); for (int i = 0; i < components; i++) lua_pushnumber(L, std::max(-1.0, (lua_Number) componentdata[i] / (lua_Number)maxval)); @@ -157,7 +157,7 @@ template static inline size_t readUNormData(lua_State *L, int components, const char *data) { const auto componentdata = (const T *) data; - const auto maxval = std::numeric_limits::max(); + constexpr auto maxval = std::numeric_limits::max(); for (int i = 0; i < components; i++) lua_pushnumber(L, (lua_Number) componentdata[i] / (lua_Number)maxval);