From 9fa4eb9aab4790ab370c92790de4f001eb50871e Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:20:16 -0700 Subject: [PATCH] Use 'contains' method --- Source/Android/jni/Cheats/GraphicsModGroup.cpp | 2 +- Source/Core/Core/CoreTiming.cpp | 2 +- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 6 ++---- Source/Core/DolphinQt/Config/GameConfigEdit.cpp | 2 +- Source/Core/DolphinQt/Config/GraphicsModListWidget.cpp | 2 +- .../ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm | 2 +- Source/Core/VideoCommon/ShaderCache.cpp | 2 +- Source/UnitTests/Core/MMIOTest.cpp | 4 ++-- Source/UnitTests/VideoCommon/VertexLoaderTest.cpp | 4 ++-- 9 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Source/Android/jni/Cheats/GraphicsModGroup.cpp b/Source/Android/jni/Cheats/GraphicsModGroup.cpp index c21584f326..35a5a92f08 100644 --- a/Source/Android/jni/Cheats/GraphicsModGroup.cpp +++ b/Source/Android/jni/Cheats/GraphicsModGroup.cpp @@ -53,7 +53,7 @@ Java_org_dolphinemu_dolphinemu_features_cheats_model_GraphicsModGroup_getMods(JN // If no group matches the mod's features, or if the mod has no features, skip it if (std::none_of(mod.m_features.begin(), mod.m_features.end(), [&groups](const GraphicsModFeatureConfig& feature) { - return groups.count(feature.m_group) == 1; + return groups.contains(feature.m_group); })) { continue; diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 7fe8160da8..f34bc5f9de 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -73,7 +73,7 @@ EventType* CoreTimingManager::RegisterEvent(const std::string& name, TimedCallba { // check for existing type with same name. // we want event type names to remain unique so that we can use them for serialization. - ASSERT_MSG(POWERPC, m_event_types.find(name) == m_event_types.end(), + ASSERT_MSG(POWERPC, !m_event_types.contains(name), "CoreTiming Event \"{}\" is already registered. Events should only be registered " "during Init to avoid breaking save states.", name); diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 049f9f6892..e46ccf9ee4 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -1101,8 +1101,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) if (IsProfilingEnabled()) ABI_CallFunction(&JitBlock::ProfileData::BeginProfiling, b->profile_data.get()); - if (code_block.m_gqr_used.Count() == 1 && - js.pairedQuantizeAddresses.find(js.blockStart) == js.pairedQuantizeAddresses.end()) + if (code_block.m_gqr_used.Count() == 1 && !js.pairedQuantizeAddresses.contains(js.blockStart)) { int gqr = *code_block.m_gqr_used.begin(); if (!code_block.m_gqr_modified[gqr] && !GQR(m_ppc_state, gqr)) @@ -1126,8 +1125,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) gpr.Start(js.gpa); fpr.Start(js.fpa); - if (js.noSpeculativeConstantsAddresses.find(js.blockStart) == - js.noSpeculativeConstantsAddresses.end()) + if (!js.noSpeculativeConstantsAddresses.contains(js.blockStart)) { IntializeSpeculativeConstants(); } diff --git a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp index 2d03d396f6..d114704f6a 100644 --- a/Source/Core/DolphinQt/Config/GameConfigEdit.cpp +++ b/Source/Core/DolphinQt/Config/GameConfigEdit.cpp @@ -143,7 +143,7 @@ void GameConfigEdit::OnSelectionChanged() { const QString& keyword = m_edit->textCursor().selectedText(); - if (m_keyword_map.count(keyword)) + if (m_keyword_map.contains(keyword)) QWhatsThis::showText(QCursor::pos(), m_keyword_map[keyword], this); } diff --git a/Source/Core/DolphinQt/Config/GraphicsModListWidget.cpp b/Source/Core/DolphinQt/Config/GraphicsModListWidget.cpp index 3aacbaac43..4eb1bb69a6 100644 --- a/Source/Core/DolphinQt/Config/GraphicsModListWidget.cpp +++ b/Source/Core/DolphinQt/Config/GraphicsModListWidget.cpp @@ -140,7 +140,7 @@ void GraphicsModListWidget::RefreshModList() // If no group matches the mod's features, or if the mod has no features, skip it if (std::none_of(mod.m_features.begin(), mod.m_features.end(), [&groups](const GraphicsModFeatureConfig& feature) { - return groups.count(feature.m_group) == 1; + return groups.contains(feature.m_group); })) { continue; diff --git a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm index 58de0c302e..5f0022c79b 100644 --- a/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm +++ b/Source/Core/InputCommon/ControllerInterface/Quartz/QuartzKeyboardAndMouse.mm @@ -179,7 +179,7 @@ std::string KeycodeToName(const CGKeyCode keycode) {kVK_RightOption, "Right Alt"}, }; - if (named_keys.find(keycode) != named_keys.end()) + if (named_keys.contains(keycode)) return named_keys.at(keycode); else return "Key " + std::to_string(keycode); diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index ca409777ce..587ee3cc7f 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -290,7 +290,7 @@ void ShaderCache::LoadPipelineCache(T& cache, Common::LinearDiskCacheGetGXPipelineConfig(real_uid); diff --git a/Source/UnitTests/Core/MMIOTest.cpp b/Source/UnitTests/Core/MMIOTest.cpp index cdc751fe92..31c943fec1 100644 --- a/Source/UnitTests/Core/MMIOTest.cpp +++ b/Source/UnitTests/Core/MMIOTest.cpp @@ -19,13 +19,13 @@ TEST(UniqueID, UniqueEnough) for (u32 i = 0x0C000000; i < 0x0C010000; ++i) { u32 unique_id = MMIO::UniqueID(i); - EXPECT_EQ(ids.end(), ids.find(unique_id)); + EXPECT_FALSE(ids.contains(unique_id)); ids.insert(unique_id); } for (u32 i = 0x0D000000; i < 0x0D010000; ++i) { u32 unique_id = MMIO::UniqueID(i); - EXPECT_EQ(ids.end(), ids.find(unique_id)); + EXPECT_FALSE(ids.contains(unique_id)); ids.insert(unique_id); } } diff --git a/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp b/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp index 09d6ce3be5..b7850e85a3 100644 --- a/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp +++ b/Source/UnitTests/VideoCommon/VertexLoaderTest.cpp @@ -28,13 +28,13 @@ TEST(VertexLoaderUID, UniqueEnough) vtx_desc.low.Hex = 0x76543210; vtx_desc.high.Hex = 0xFEDCBA98; - EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat))); + EXPECT_FALSE(uids.contains(VertexLoaderUID(vtx_desc, vat))); uids.insert(VertexLoaderUID(vtx_desc, vat)); vat.g0.Hex = 0xFFFFFFFF; vat.g1.Hex = 0xFFFFFFFF; vat.g2.Hex = 0xFFFFFFFF; - EXPECT_EQ(uids.end(), uids.find(VertexLoaderUID(vtx_desc, vat))); + EXPECT_FALSE(uids.contains(VertexLoaderUID(vtx_desc, vat))); uids.insert(VertexLoaderUID(vtx_desc, vat)); }