diff --git a/taglib/shn/shnfile.cpp b/taglib/shn/shnfile.cpp index 24f6a8b5..3d2a5f91 100644 --- a/taglib/shn/shnfile.cpp +++ b/taglib/shn/shnfile.cpp @@ -223,8 +223,20 @@ namespace { T value = *reinterpret_cast(reinterpret_cast(p) + n); auto system_big = Utils::systemByteOrder() == Utils::BigEndian; - if(big != system_big) - value = Utils::byteSwap(value); + if constexpr (std::is_same_v) { + if(big != system_big) + value = Utils::byteSwap(static_cast(value)); + } + else if constexpr (std::is_same_v) { + if(big != system_big) + value = Utils::byteSwap(static_cast(value)); + } + else if constexpr (std::is_same_v) { + if(big != system_big) + value = Utils::byteSwap(static_cast(value)); + } + else + static_assert(false, "Invalid typename T"); return value; }