From 86c8773e0635aed61dfc7266b12cd5e2c3d7e2eb Mon Sep 17 00:00:00 2001 From: silverqx Date: Sun, 4 Aug 2024 09:28:06 +0200 Subject: [PATCH] bugfix IntegralCast<> and long int type Added support for Platform dependent long type. --- include/orm/utils/integralcast.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/orm/utils/integralcast.hpp b/include/orm/utils/integralcast.hpp index 133898acd..a563aa455 100644 --- a/include/orm/utils/integralcast.hpp +++ b/include/orm/utils/integralcast.hpp @@ -37,6 +37,36 @@ namespace Private else if constexpr (std::is_same_v) return "bool"; + // Platform dependent long int type (LP64, LLP64, ILP32, and LP32) + else if constexpr (std::is_same_v) { + + if constexpr (sizeof (T) == 4) + return "int32 (long)"; + else if constexpr (sizeof (T) == 8) + return "int64 (long)"; + else if constexpr (sizeof (T) == 2) + return "int16 (long)"; + else + // This should never happen :/ + static_assert (false, + "Unhandled code branch in the Private::IntegralTypeName() " + "(long)."); + } + else if constexpr (std::is_same_v) { + + if constexpr (sizeof (T) == 4) + return "uint32 (ulong)"; + else if constexpr (sizeof (T) == 8) + return "uint64 (ulong)"; + else if constexpr (sizeof (T) == 2) + return "uint16 (ulong)"; + else + // This should never happen :/ + static_assert (false, + "Unhandled code branch in the Private::IntegralTypeName() " + "(ulong)."); + } + else if constexpr (std::is_same_v) return "int16"; else if constexpr (std::is_same_v)