diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp index 43d4960849..5a313eadb6 100644 --- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp +++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp @@ -13,6 +13,12 @@ namespace utils { return std::span(bless(span.data()), sizeof(U) * span.size() / sizeof(T)); } + + template + bool is_power_of_2(T value) + { + return std::has_single_bit(value); + } } namespace diff --git a/rpcs3/util/asm.hpp b/rpcs3/util/asm.hpp index 571c70a0f1..5757e06233 100644 --- a/rpcs3/util/asm.hpp +++ b/rpcs3/util/asm.hpp @@ -385,13 +385,6 @@ namespace utils return static_cast(value / align + (value > 0 ? T{(value % align) > (align / 2)} : 0 - T{(value % align) < (align / 2)})); } - // Returns true if input is an unsigned integer with a power of 2 - template requires(std::is_integral_v && std::is_unsigned_v) - constexpr T is_power_of_2(T value) - { - return !(value & (value - 1)); - } - // Hack. Pointer cast util to workaround UB. Use with extreme care. template [[nodiscard]] T* bless(U* ptr)