diff --git a/openVulkanoCpp/Math/RGB565.hpp b/openVulkanoCpp/Math/RGB565.hpp index 2a667d7..ef86ed6 100644 --- a/openVulkanoCpp/Math/RGB565.hpp +++ b/openVulkanoCpp/Math/RGB565.hpp @@ -13,14 +13,22 @@ namespace OpenVulkano::Math { class RGB565 { - static uint16_t Make5(int16_t val) + template + static uint16_t Make5(T val) { - val = std::clamp(val, 0, 255); + if constexpr (std::is_same_v || std::is_same_v) + { + val = std::clamp(val, 0, 255); + } return val * 31.0f / 255.0f; } - static uint16_t Make6(int16_t val) + template + static uint16_t Make6(T val) { - val = std::clamp(val, 0, 255); + if constexpr (std::is_same_v || std::is_same_v) + { + val = std::clamp(val, 0, 255); + } return val * 63.0f / 255.0f; } static uint8_t Unmake5(uint16_t val) { return static_cast(val * 255.0f / 31.0f); }