summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-01-17 20:08:02 -0500
committerGravatar Lioncash2018-01-17 20:09:41 -0500
commitb16c89bf659503687cef67782127e7694e98f0d3 (patch)
tree88d66fde318ce2cb92d024a90a1c4af0428f3f57 /src
parentMerge pull request #73 from N00byKing/3093 (diff)
downloadyuzu-b16c89bf659503687cef67782127e7694e98f0d3.tar.gz
yuzu-b16c89bf659503687cef67782127e7694e98f0d3.tar.xz
yuzu-b16c89bf659503687cef67782127e7694e98f0d3.zip
vi: Copy data directly into the std::vector within Parcel's ReadBlock function
Previously this would unnecessarily zero-initialize the vector before copying the actual data into the vector instance.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/vi/vi.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index cae2c4466..57ad4c59c 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -47,8 +47,9 @@ public:
47 } 47 }
48 48
49 std::vector<u8> ReadBlock(size_t length) { 49 std::vector<u8> ReadBlock(size_t length) {
50 std::vector<u8> data(length); 50 const u8* const begin = buffer.data() + read_index;
51 std::memcpy(data.data(), buffer.data() + read_index, length); 51 const u8* const end = begin + length;
52 std::vector<u8> data(begin, end);
52 read_index += length; 53 read_index += length;
53 read_index = Common::AlignUp(read_index, 4); 54 read_index = Common::AlignUp(read_index, 4);
54 return data; 55 return data;