Merge pull request #12526 from lioncash/trace

CodeTrace: Use std::set::lower_bound() over std::lower_bound()
This commit is contained in:
JosJuice 2024-01-24 17:56:39 +01:00 committed by GitHub
commit 74d4cb0274
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -53,12 +53,11 @@ u32 GetMemoryTargetSize(std::string_view instr)
bool CompareMemoryTargetToTracked(const std::string& instr, const u32 mem_target,
const std::set<u32>& mem_tracked)
{
// This function is hit often and should be optimized.
auto it_lower = std::lower_bound(mem_tracked.begin(), mem_tracked.end(), mem_target);
const auto it_lower = mem_tracked.lower_bound(mem_target);
if (it_lower == mem_tracked.end())
return false;
else if (*it_lower == mem_target)
if (*it_lower == mem_target)
return true;
// If the base value doesn't hit, still need to check if longer values overlap.