diff --git a/libvapours/include/vapours/util/util_bitpack.hpp b/libvapours/include/vapours/util/util_bitpack.hpp index ccec50e9..914d5b2d 100644 --- a/libvapours/include/vapours/util/util_bitpack.hpp +++ b/libvapours/include/vapours/util/util_bitpack.hpp @@ -33,7 +33,11 @@ namespace ams::util { static_assert(0 < Count && Count <= BITSIZEOF(IntegralStorageType)); static_assert(Index + Count <= BITSIZEOF(IntegralStorageType)); - return ((IntegralStorageType(1) << Count) - 1) << Index; + if constexpr (Count == BITSIZEOF(IntegralStorageType)) { + return ~IntegralStorageType(0); + } else { + return ((IntegralStorageType(1) << Count) - 1) << Index; + } }(); public: template @@ -52,6 +56,8 @@ namespace ams::util { private: IntegralStorageType value; public: + constexpr ALWAYS_INLINE BitPack(IntegralStorageType v) : value(v) { /* ... */ } + constexpr ALWAYS_INLINE void Clear() { constexpr IntegralStorageType Zero = IntegralStorageType(0); this->value = Zero; @@ -79,9 +85,9 @@ namespace ams::util { using BitPack32 = impl::BitPack; using BitPack64 = impl::BitPack; - static_assert(std::is_pod::value); - static_assert(std::is_pod::value); - static_assert(std::is_pod::value); - static_assert(std::is_pod::value); + static_assert(std::is_trivially_destructible::value); + static_assert(std::is_trivially_destructible::value); + static_assert(std::is_trivially_destructible::value); + static_assert(std::is_trivially_destructible::value); }