mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 02:32:46 +01:00
fsp_srv: Remove unnecessary vector construction in IFile's Write() function
We can avoid constructing a std::vector here by simply passing a pointer to the original data and the size of the copy we wish to perform to the backend's Write() function instead, avoiding copying the data where it's otherwise not needed.
This commit is contained in:
parent
3e9b79e088
commit
6c1ba02e0c
1 changed files with 3 additions and 2 deletions
|
@ -149,8 +149,9 @@ private:
|
|||
length, data.size());
|
||||
|
||||
// Write the data to the Storage backend
|
||||
std::vector<u8> actual_data(data.begin(), data.begin() + length);
|
||||
const std::size_t written = backend->WriteBytes(std::move(actual_data), offset);
|
||||
const auto write_size =
|
||||
static_cast<std::size_t>(std::distance(data.begin(), data.begin() + length));
|
||||
const std::size_t written = backend->Write(data.data(), write_size, offset);
|
||||
|
||||
ASSERT_MSG(static_cast<s64>(written) == length,
|
||||
"Could not write all bytes to file (requested={:016X}, actual={:016X}).", length,
|
||||
|
|
Loading…
Reference in a new issue