diff --git a/rpcs3/util/asm.hpp b/rpcs3/util/asm.hpp index d4e15468e2..a31b5c6102 100644 --- a/rpcs3/util/asm.hpp +++ b/rpcs3/util/asm.hpp @@ -366,24 +366,24 @@ namespace utils } // Align to power of 2 - template ::value && std::is_unsigned::value>> - constexpr T align(T value, ullong align) + template >> + constexpr T align(T value, std::type_identity_t align) { - return static_cast((value + (align - 1)) & (0 - align)); + return static_cast((value + (align - 1)) & (T{0} - align)); } // General purpose aligned division, the result is rounded up not truncated - template ::value && std::is_unsigned::value>> + template >> constexpr T aligned_div(T value, std::type_identity_t align) { return static_cast(value / align + T{!!(value % align)}); } // General purpose aligned division, the result is rounded to nearest - template ::value>> + template >> constexpr T rounded_div(T value, std::type_identity_t align) { - if constexpr (std::is_unsigned::value) + if constexpr (std::is_unsigned_v) { return static_cast(value / align + T{(value % align) > (align / 2)}); }