From cf1873fe48c4a9245b7a0b7b498e3346e4a727c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= Date: Mon, 21 Oct 2024 19:52:48 +0300 Subject: [PATCH] Use constexpr if in checked_diff function --- include/upa/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/upa/util.h b/include/upa/util.h index 49c02bd..92b2799 100644 --- a/include/upa/util.h +++ b/include/upa/util.h @@ -56,7 +56,7 @@ inline Out checked_diff(T a, T b) { const UT diff = static_cast(static_cast(a) - static_cast(b)); if (diff <= unsigned_limit::max()) return static_cast(diff); - } else if (std::is_signed_v) { + } else if constexpr (std::is_signed_v) { // b > a ==> diff >= 1 const UT diff = static_cast(static_cast(b) - static_cast(a)); if (diff <= unsigned_limit::min())