From 6f771e0ed7cd00113059df11180df92f2fb293ec Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 3 Oct 2024 16:46:57 +0200 Subject: [PATCH] refactor: `shorten_T` removed --- .../include/mp-units/framework/magnitude.h | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/core/include/mp-units/framework/magnitude.h b/src/core/include/mp-units/framework/magnitude.h index 898ee2b5..199e0b4d 100644 --- a/src/core/include/mp-units/framework/magnitude.h +++ b/src/core/include/mp-units/framework/magnitude.h @@ -145,33 +145,16 @@ template return ratio{1}; } -// We do not want magnitude type to have the `l` literal after a value for a small integral number. -// For example this modifies `magnitude<3l>` to be `magnitude<3>` -template -[[nodiscard]] consteval auto shorten_T() -{ - if constexpr (std::integral) { - if constexpr (V <= std::numeric_limits::max()) - return static_cast(V); - else - return static_cast(V); - } else if constexpr (std::floating_point) { - return static_cast(V); - } else { - return V; - } -} - template [[nodiscard]] consteval auto power_v_or_T() { if constexpr (R.den == 1) { if constexpr (R.num == 1) - return shorten_T(); + return V; else - return power_v(), R.num>{}; + return power_v{}; } else { - return power_v(), R.num, R.den>{}; + return power_v{}; } }