diff --git a/rpcs3/Emu/RSX/Common/simple_array.hpp b/rpcs3/Emu/RSX/Common/simple_array.hpp index 633cae62c9..6fd18ddd1d 100644 --- a/rpcs3/Emu/RSX/Common/simple_array.hpp +++ b/rpcs3/Emu/RSX/Common/simple_array.hpp @@ -16,7 +16,7 @@ namespace rsx }; template - requires std::is_trivially_destructible_v + requires std::is_trivially_destructible_v && std::is_trivially_copyable_v struct simple_array { public: @@ -178,24 +178,11 @@ namespace rsx return; } - if constexpr (std::is_trivially_copyable_v) - { - // Use memcpy to allow compiler optimizations - Ty _stack_alloc[_local_capacity]; - std::memcpy(_stack_alloc, that._data, that.size_bytes()); - std::memcpy(that._data, _data, size_bytes()); - std::memcpy(_data, _stack_alloc, that.size_bytes()); - } - else - { - // Safe path: use element-wise std::swap - const usz count = std::max(size(), that.size()); - for (usz i = 0; i < count; ++i) - { - std::swap(_data[i], that._data[i]); - } - } - + // Use memcpy to allow compiler optimizations + Ty _stack_alloc[_local_capacity]; + std::memcpy(_stack_alloc, that._data, that.size_bytes()); + std::memcpy(that._data, _data, size_bytes()); + std::memcpy(_data, _stack_alloc, that.size_bytes()); std::swap(_size, that._size); }