From 861580f6d2a34326dd134c9767fbba945840ef1b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 26 Sep 2018 17:25:14 -0400 Subject: [PATCH] fsmitm_romfsbuild: std::move std::vector instances in Build() Avoids making copies of large std::vector instances where it's trivially avoidable to do so. --- src/core/file_sys/fsmitm_romfsbuild.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/fsmitm_romfsbuild.cpp b/src/core/file_sys/fsmitm_romfsbuild.cpp index 3a17864db..2a913ce82 100644 --- a/src/core/file_sys/fsmitm_romfsbuild.cpp +++ b/src/core/file_sys/fsmitm_romfsbuild.cpp @@ -345,7 +345,7 @@ std::map RomFSBuildContext::Build() { std::vector header_data(sizeof(RomFSHeader)); std::memcpy(header_data.data(), &header, header_data.size()); - out.emplace(0, std::make_shared(header_data)); + out.emplace(0, std::make_shared(std::move(header_data))); std::vector metadata(file_hash_table_size + file_table_size + dir_hash_table_size + dir_table_size); @@ -358,7 +358,7 @@ std::map RomFSBuildContext::Build() { file_hash_table.size() * sizeof(u32)); index += file_hash_table.size() * sizeof(u32); std::memcpy(metadata.data() + index, file_table.data(), file_table.size()); - out.emplace(header.dir_hash_table_ofs, std::make_shared(metadata)); + out.emplace(header.dir_hash_table_ofs, std::make_shared(std::move(metadata))); return out; }