From c9d2aed286c4b9c9754870ea11cf2828260db67c Mon Sep 17 00:00:00 2001 From: p01arst0rm Date: Wed, 14 Apr 2021 20:44:37 +0100 Subject: [PATCH] small collection of fixes --- Utilities/Thread.cpp | 2 +- rpcs3/Emu/RSX/RSXFragmentProgram.h | 13 +++++++------ rpcs3/util/shared_ptr.hpp | 22 ++++------------------ 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 368bae4d44..864be57071 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -450,7 +450,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, usz } case 0x7f: { - if ((repe && !oso) || (!repe && oso)) // MOVDQU/MOVDQA xmm/m, xmm + if (repe != oso) // MOVDQU/MOVDQA xmm/m, xmm { out_op = X64OP_STORE; out_reg = get_modRM_reg_xmm(code, rex); diff --git a/rpcs3/Emu/RSX/RSXFragmentProgram.h b/rpcs3/Emu/RSX/RSXFragmentProgram.h index 3b03701929..9c89dff266 100644 --- a/rpcs3/Emu/RSX/RSXFragmentProgram.h +++ b/rpcs3/Emu/RSX/RSXFragmentProgram.h @@ -255,6 +255,8 @@ struct RSXFragmentProgram data_storage_helper& operator=(const data_storage_helper& other) { + if (this == &other) return *this; + if (other.data_ptr == other.local_storage.data()) { local_storage = other.local_storage; @@ -271,12 +273,11 @@ struct RSXFragmentProgram data_storage_helper& operator=(data_storage_helper&& other) { - if (this != &other) - { - data_ptr = other.data_ptr; - local_storage = std::move(other.local_storage); - other.data_ptr = nullptr; - } + if (this == &other) return *this; + + data_ptr = other.data_ptr; + local_storage = std::move(other.local_storage); + other.data_ptr = nullptr; return *this; } diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index 0b420c8faf..b9fb144751 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -1053,15 +1053,8 @@ namespace stx ensure(is_same_ptr_test(cmp.m_ptr)); shared_type old = cmp; - - if (compare_exchange(old, std::move(exch))) - { - return old; - } - else - { - return old; - } + static_cast(compare_exchange(old, std::move(exch))); + return old; } // More lightweight than compare_exchange @@ -1114,15 +1107,8 @@ namespace stx ensure(is_same_ptr_test(cmp.m_ptr)); shared_type old = cmp; - - if (compare_exchange(old, std::move(exch))) - { - return old; - } - else - { - return old; - } + static_cast(compare_exchange(old, std::move(exch))); + return old; } // Supplementary