mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
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.
This commit is contained in:
parent
ee08c39b72
commit
b16c89bf65
1 changed files with 3 additions and 2 deletions
|
@ -47,8 +47,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> ReadBlock(size_t length) {
|
std::vector<u8> ReadBlock(size_t length) {
|
||||||
std::vector<u8> data(length);
|
const u8* const begin = buffer.data() + read_index;
|
||||||
std::memcpy(data.data(), buffer.data() + read_index, length);
|
const u8* const end = begin + length;
|
||||||
|
std::vector<u8> data(begin, end);
|
||||||
read_index += length;
|
read_index += length;
|
||||||
read_index = Common::AlignUp(read_index, 4);
|
read_index = Common::AlignUp(read_index, 4);
|
||||||
return data;
|
return data;
|
||||||
|
|
Loading…
Reference in a new issue