Use 'contains' method

This commit is contained in:
mitaclaw 2024-08-15 14:20:16 -07:00
parent 18ac8bf405
commit 9fa4eb9aab
9 changed files with 12 additions and 14 deletions

View File

@ -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 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(), if (std::none_of(mod.m_features.begin(), mod.m_features.end(),
[&groups](const GraphicsModFeatureConfig& feature) { [&groups](const GraphicsModFeatureConfig& feature) {
return groups.count(feature.m_group) == 1; return groups.contains(feature.m_group);
})) }))
{ {
continue; continue;

View File

@ -73,7 +73,7 @@ EventType* CoreTimingManager::RegisterEvent(const std::string& name, TimedCallba
{ {
// check for existing type with same name. // check for existing type with same name.
// we want event type names to remain unique so that we can use them for serialization. // 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 " "CoreTiming Event \"{}\" is already registered. Events should only be registered "
"during Init to avoid breaking save states.", "during Init to avoid breaking save states.",
name); name);

View File

@ -1101,8 +1101,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
if (IsProfilingEnabled()) if (IsProfilingEnabled())
ABI_CallFunction(&JitBlock::ProfileData::BeginProfiling, b->profile_data.get()); ABI_CallFunction(&JitBlock::ProfileData::BeginProfiling, b->profile_data.get());
if (code_block.m_gqr_used.Count() == 1 && if (code_block.m_gqr_used.Count() == 1 && !js.pairedQuantizeAddresses.contains(js.blockStart))
js.pairedQuantizeAddresses.find(js.blockStart) == js.pairedQuantizeAddresses.end())
{ {
int gqr = *code_block.m_gqr_used.begin(); int gqr = *code_block.m_gqr_used.begin();
if (!code_block.m_gqr_modified[gqr] && !GQR(m_ppc_state, gqr)) 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); gpr.Start(js.gpa);
fpr.Start(js.fpa); fpr.Start(js.fpa);
if (js.noSpeculativeConstantsAddresses.find(js.blockStart) == if (!js.noSpeculativeConstantsAddresses.contains(js.blockStart))
js.noSpeculativeConstantsAddresses.end())
{ {
IntializeSpeculativeConstants(); IntializeSpeculativeConstants();
} }

View File

@ -143,7 +143,7 @@ void GameConfigEdit::OnSelectionChanged()
{ {
const QString& keyword = m_edit->textCursor().selectedText(); 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); QWhatsThis::showText(QCursor::pos(), m_keyword_map[keyword], this);
} }

View File

@ -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 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(), if (std::none_of(mod.m_features.begin(), mod.m_features.end(),
[&groups](const GraphicsModFeatureConfig& feature) { [&groups](const GraphicsModFeatureConfig& feature) {
return groups.count(feature.m_group) == 1; return groups.contains(feature.m_group);
})) }))
{ {
continue; continue;

View File

@ -179,7 +179,7 @@ std::string KeycodeToName(const CGKeyCode keycode)
{kVK_RightOption, "Right Alt"}, {kVK_RightOption, "Right Alt"},
}; };
if (named_keys.find(keycode) != named_keys.end()) if (named_keys.contains(keycode))
return named_keys.at(keycode); return named_keys.at(keycode);
else else
return "Key " + std::to_string(keycode); return "Key " + std::to_string(keycode);

View File

@ -290,7 +290,7 @@ void ShaderCache::LoadPipelineCache(T& cache, Common::LinearDiskCache<DiskKeyTyp
UnserializePipelineUid(key, real_uid); UnserializePipelineUid(key, real_uid);
// Skip those which are already compiled. // Skip those which are already compiled.
if (failed || cache.find(real_uid) != cache.end()) if (failed || cache.contains(real_uid))
return; return;
auto config = this_ptr->GetGXPipelineConfig(real_uid); auto config = this_ptr->GetGXPipelineConfig(real_uid);

View File

@ -19,13 +19,13 @@ TEST(UniqueID, UniqueEnough)
for (u32 i = 0x0C000000; i < 0x0C010000; ++i) for (u32 i = 0x0C000000; i < 0x0C010000; ++i)
{ {
u32 unique_id = MMIO::UniqueID(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); ids.insert(unique_id);
} }
for (u32 i = 0x0D000000; i < 0x0D010000; ++i) for (u32 i = 0x0D000000; i < 0x0D010000; ++i)
{ {
u32 unique_id = MMIO::UniqueID(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); ids.insert(unique_id);
} }
} }

View File

@ -28,13 +28,13 @@ TEST(VertexLoaderUID, UniqueEnough)
vtx_desc.low.Hex = 0x76543210; vtx_desc.low.Hex = 0x76543210;
vtx_desc.high.Hex = 0xFEDCBA98; 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)); uids.insert(VertexLoaderUID(vtx_desc, vat));
vat.g0.Hex = 0xFFFFFFFF; vat.g0.Hex = 0xFFFFFFFF;
vat.g1.Hex = 0xFFFFFFFF; vat.g1.Hex = 0xFFFFFFFF;
vat.g2.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)); uids.insert(VertexLoaderUID(vtx_desc, vat));
} }