summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-07-24 20:29:37 +0200
committerGitHub <noreply@github.com>2020-07-24 20:29:37 +0200
commitd488cb843e65e10babc51edb6b741b2b3f38aeae (patch)
tree66ea37433c81262b0fa1b339a0204f9e5aee9ed0 /src
parentMerge pull request #4391 from lioncash/nrvo (diff)
parentbuffer_cache: Eliminate redundant map lookup in MarkRegionAsWritten() (diff)
downloadyuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar
yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.gz
yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.bz2
yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.lz
yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.xz
yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.tar.zst
yuzu-d488cb843e65e10babc51edb6b741b2b3f38aeae.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index dd7ce8c99..b5dc68902 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -524,11 +524,8 @@ private:
void MarkRegionAsWritten(VAddr start, VAddr end) {
const u64 page_end = end >> WRITE_PAGE_BIT;
for (u64 page_start = start >> WRITE_PAGE_BIT; page_start <= page_end; ++page_start) {
- auto it = written_pages.find(page_start);
- if (it != written_pages.end()) {
- it->second = it->second + 1;
- } else {
- written_pages.insert_or_assign(page_start, 1);
+ if (const auto [it, inserted] = written_pages.emplace(page_start, 1); !inserted) {
+ ++it->second;
}
}
}
@@ -539,7 +536,7 @@ private:
auto it = written_pages.find(page_start);
if (it != written_pages.end()) {
if (it->second > 1) {
- it->second = it->second - 1;
+ --it->second;
} else {
written_pages.erase(it);
}