From 9599a7aef8a544232b79e3b776610162971d46a9 Mon Sep 17 00:00:00 2001 From: Vladyslav Baranovskyi Date: Thu, 7 Nov 2024 20:16:06 +0200 Subject: [PATCH] Numeric limits for int24 class --- openVulkanoCpp/Math/Int24.hpp | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/openVulkanoCpp/Math/Int24.hpp b/openVulkanoCpp/Math/Int24.hpp index 5676084..8eb8f5b 100644 --- a/openVulkanoCpp/Math/Int24.hpp +++ b/openVulkanoCpp/Math/Int24.hpp @@ -243,4 +243,46 @@ namespace OpenVulkano return (int)*this < val; } }; +} + +namespace std +{ + template <> + class numeric_limits + { + public: + static const bool is_specialized = true; + static constexpr OpenVulkano::int24 min() { return OpenVulkano::int24(0); } + static constexpr OpenVulkano::int24 max() { return OpenVulkano::int24(0xFFFFFF); } + static const int radix = 2; + static const int digits = 24; + static const int digits10 = 7; + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const bool traps = false; + static const bool is_modulo = true; + static const bool is_bounded = true; + + static constexpr OpenVulkano::int24 epsilon() { return OpenVulkano::int24(1); } + static constexpr OpenVulkano::int24 round_error() { return OpenVulkano::int24(0); } + static const int min_exponent10 = 0; + static const int max_exponent10 = 0; + static const int min_exponent = 0; + static const int max_exponent = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const bool is_iec559 = false; + static const bool has_denorm = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + // Not meaningful for int24... + static constexpr OpenVulkano::int24 denorm_min() { return OpenVulkano::int24(0); } + static constexpr OpenVulkano::int24 infinity() { return OpenVulkano::int24(0); } + static constexpr OpenVulkano::int24 quiet_NaN() { return OpenVulkano::int24(0); } + static constexpr OpenVulkano::int24 signaling_NaN() { return OpenVulkano::int24(0); } + }; } \ No newline at end of file