From 4c33bb8dda7497657e981d0b2136785731f5288a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 29 May 2018 18:01:13 -0400 Subject: [PATCH 1/2] MemoryPatches: std::move std::vector in the constructor We can avoid copying the vector contents in this instance. --- Source/Core/Common/Debug/MemoryPatches.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/Debug/MemoryPatches.cpp b/Source/Core/Common/Debug/MemoryPatches.cpp index db7a40c58b..aaded7343d 100644 --- a/Source/Core/Common/Debug/MemoryPatches.cpp +++ b/Source/Core/Common/Debug/MemoryPatches.cpp @@ -6,11 +6,12 @@ #include #include +#include namespace Common::Debug { MemoryPatch::MemoryPatch(u32 address_, std::vector value_) - : address(address_), value(value_), is_enabled(State::Enabled) + : address(address_), value(std::move(value_)), is_enabled(State::Enabled) { } From 397b27e6652a3f81875669036ac0e50aaea6bb48 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 29 May 2018 18:03:12 -0400 Subject: [PATCH 2/2] MemoryPatches: In-class initialize is_enabled state for MemoryPatch instances Given this is what occurs in both constructors (as one just passes through to another), we can just initialize the member directly. While we're at it, amend the struct to follow the general ordering convention of: --- Source/Core/Common/Debug/MemoryPatches.cpp | 2 +- Source/Core/Common/Debug/MemoryPatches.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Common/Debug/MemoryPatches.cpp b/Source/Core/Common/Debug/MemoryPatches.cpp index aaded7343d..38f96863d0 100644 --- a/Source/Core/Common/Debug/MemoryPatches.cpp +++ b/Source/Core/Common/Debug/MemoryPatches.cpp @@ -11,7 +11,7 @@ namespace Common::Debug { MemoryPatch::MemoryPatch(u32 address_, std::vector value_) - : address(address_), value(std::move(value_)), is_enabled(State::Enabled) + : address(address_), value(std::move(value_)) { } diff --git a/Source/Core/Common/Debug/MemoryPatches.h b/Source/Core/Common/Debug/MemoryPatches.h index cee814c6b5..6307833abe 100644 --- a/Source/Core/Common/Debug/MemoryPatches.h +++ b/Source/Core/Common/Debug/MemoryPatches.h @@ -20,12 +20,12 @@ struct MemoryPatch Disabled }; - u32 address; - std::vector value; - State is_enabled; - MemoryPatch(u32 address, std::vector value); MemoryPatch(u32 address, u32 value); + + u32 address; + std::vector value; + State is_enabled = State::Enabled; }; class MemoryPatches