summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2025-08-01 21:43:12 +0200
committerGitHub <noreply@github.com>2025-08-01 21:43:12 +0200
commit06e05e0f908595d8d4d43e98ffdad92bc5740d5c (patch)
tree3addcabb237a0ebd5ae4f3c5f687075fce332a4e /Source/Core/Common
parent36aa7b6f3f721ec34f15e21a9e7c6256d2ba22f9 (diff)
parentf2392e4048ce977bad2227d08f3a042526f7c4da (diff)
Merge pull request #13794 from Sintendo/doouble-lookup
Avoid map/set double lookups
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Assembler/GekkoIRGen.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Source/Core/Common/Assembler/GekkoIRGen.cpp b/Source/Core/Common/Assembler/GekkoIRGen.cpp
index 7ec7c476ba..51cbbb4208 100644
--- a/Source/Core/Common/Assembler/GekkoIRGen.cpp
+++ b/Source/Core/Common/Assembler/GekkoIRGen.cpp
@@ -356,14 +356,13 @@ void GekkoIRPlugin::OnCloseParen(ParenType type)
void GekkoIRPlugin::OnLabelDecl(std::string_view name)
{
const std::string name_str(name);
- if (m_symset.contains(name_str))
+ if (const bool inserted = m_symset.insert(name_str).second; !inserted)
{
m_owner->EmitErrorHere(fmt::format("Label/Constant {} is already defined", name));
return;
}
m_labels[name_str] = m_active_block->BlockEndAddress();
- m_symset.insert(name_str);
}
void GekkoIRPlugin::OnNumericLabelDecl(std::string_view, u32 num)
@@ -374,14 +373,13 @@ void GekkoIRPlugin::OnNumericLabelDecl(std::string_view, u32 num)
void GekkoIRPlugin::OnVarDecl(std::string_view name)
{
const std::string name_str(name);
- if (m_symset.contains(name_str))
+ if (const bool inserted = m_symset.insert(name_str).second; !inserted)
{
m_owner->EmitErrorHere(fmt::format("Label/Constant {} is already defined", name));
return;
}
m_active_var = &m_constants[name_str];
- m_symset.insert(name_str);
}
void GekkoIRPlugin::PostParseAction()