From b16c89bf659503687cef67782127e7694e98f0d3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 17 Jan 2018 20:08:02 -0500 Subject: 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. --- src/core/hle/service/vi/vi.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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: } std::vector ReadBlock(size_t length) { - std::vector data(length); - std::memcpy(data.data(), buffer.data() + read_index, length); + const u8* const begin = buffer.data() + read_index; + const u8* const end = begin + length; + std::vector data(begin, end); read_index += length; read_index = Common::AlignUp(read_index, 4); return data; -- cgit v1.2.3