Skip to content

Commit

Permalink
bugfix IntegralCast<> and long int type
Browse files Browse the repository at this point in the history
Added support for Platform dependent long type.
  • Loading branch information
silverqx committed Aug 4, 2024
1 parent 9222a65 commit 86c8773
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions include/orm/utils/integralcast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ namespace Private
else if constexpr (std::is_same_v<T, bool>)
return "bool";

// Platform dependent long int type (LP64, LLP64, ILP32, and LP32)
else if constexpr (std::is_same_v<T, long int>) {

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<T>() "
"(long).");
}
else if constexpr (std::is_same_v<T, unsigned long int>) {

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<T>() "
"(ulong).");
}

else if constexpr (std::is_same_v<T, qint16>)
return "int16";
else if constexpr (std::is_same_v<T, quint16>)
Expand Down

0 comments on commit 86c8773

Please sign in to comment.