diff options
author | Lioncash <mathew1800@gmail.com> | 2019-07-24 13:24:19 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-08-30 01:29:43 +0200 |
commit | 56c6f767ae7368a2b2355e002384bf4d5f672132 (patch) | |
tree | b943949eaf77425109202f00aa365814b455c0ad /src/core | |
parent | kernel/vm_manager: std::move shared_ptr instance in MergeAdjacentVMA (diff) | |
download | yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.tar yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.tar.gz yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.tar.bz2 yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.tar.lz yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.tar.xz yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.tar.zst yuzu-56c6f767ae7368a2b2355e002384bf4d5f672132.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 721f7cc44..6b2d78cc8 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -765,11 +765,14 @@ void VMManager::MergeAdjacentVMA(VirtualMemoryArea& left, const VirtualMemoryAre // Fast case: left is an entire backing block. left.backing_block->insert(left.backing_block->end(), right_begin, right_end); } else { + // Slow case: make a new memory block for left and right. const auto left_begin = left.backing_block->begin() + left.offset; const auto left_end = left_begin + left.size; + const auto left_size = static_cast<std::size_t>(std::distance(left_begin, left_end)); + const auto right_size = static_cast<std::size_t>(std::distance(right_begin, right_end)); - // Slow case: make a new memory block for left and right. auto new_memory = std::make_shared<PhysicalMemory>(); + new_memory->reserve(left_size + right_size); new_memory->insert(new_memory->end(), left_begin, left_end); new_memory->insert(new_memory->end(), right_begin, right_end); |