1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

rsx: Apply Clang-Tidy fix "modernize-loop-convert" + const when relevant

This commit is contained in:
scribam 2019-06-08 10:35:09 +02:00 committed by kd-11
parent 1e327ad31b
commit 13671d9684
5 changed files with 23 additions and 23 deletions

View File

@ -90,11 +90,11 @@ struct ParamType
{
}
bool SearchName(const std::string& name)
bool SearchName(const std::string& name) const
{
for (u32 i = 0; i<items.size(); ++i)
for (const auto& item : items)
{
if (items[i].name == name) return true;
if (item.name == name) return true;
}
return false;
@ -107,10 +107,10 @@ struct ParamArray
ParamType* SearchParam(const ParamFlag &flag, const std::string& type)
{
for (u32 i = 0; i<params[flag].size(); ++i)
for (auto& param : params[flag])
{
if (params[flag][i].type == type)
return &params[flag][i];
if (param.type == type)
return &param;
}
return nullptr;
@ -118,9 +118,9 @@ struct ParamArray
bool HasParamTypeless(const ParamFlag flag, const std::string& name)
{
for (u32 i = 0; i<params[flag].size(); ++i)
for (const auto& param : params[flag])
{
if (params[flag][i].SearchName(name))
if (param.SearchName(name))
return true;
}

View File

@ -373,9 +373,9 @@ std::string VertexProgramDecompiler::BuildCode()
lvl++;
}
for (uint j = 0; j < m_instructions[i].body.size(); ++j)
for (const auto& instruction_body : m_instructions[i].body)
{
main_body.append(lvl, '\t') += m_instructions[i].body[j] + "\n";
main_body.append(lvl, '\t') += instruction_body + "\n";
}
lvl += m_instructions[i].open_scopes;
@ -420,14 +420,14 @@ std::string VertexProgramDecompiler::Decompile()
u32 i = 1;
u32 last_label_addr = 0;
for (unsigned i = 0; i < PF_PARAM_COUNT; i++)
for (auto& param : m_parr.params)
{
m_parr.params[i].clear();
param.clear();
}
for (int i = 0; i < m_max_instr_count; ++i)
for (auto& instruction : m_instructions)
{
m_instructions[i].reset();
instruction.reset();
}
if (!m_prog.jump_table.empty())

View File

@ -539,11 +539,11 @@ namespace gl
void remove_temp_resources(u64 key)
{
std::vector<u64> keys_to_remove;
for (auto It = temp_image_cache.begin(); It != temp_image_cache.end(); ++It)
for (const auto& temp_image : temp_image_cache)
{
if (It->second.first == key)
if (temp_image.second.first == key)
{
keys_to_remove.push_back(It->first);
keys_to_remove.push_back(temp_image.first);
}
}

View File

@ -2172,11 +2172,11 @@ namespace rsx
if (zeta_address)
{
//Find zeta address in bound zculls
for (int i = 0; i < rsx::limits::zculls_count; i++)
for (const auto& zcull : zculls)
{
if (zculls[i].binded)
if (zcull.binded)
{
const u32 rsx_address = rsx::get_address(zculls[i].offset, CELL_GCM_LOCATION_LOCAL);
const u32 rsx_address = rsx::get_address(zcull.offset, CELL_GCM_LOCATION_LOCAL);
if (rsx_address == zeta_address)
{
zcull_surface_active = true;

View File

@ -661,11 +661,11 @@ namespace vk
void remove_temp_resources(u32 key)
{
std::vector<u64> keys_to_remove;
for (auto It = temp_image_cache.begin(); It != temp_image_cache.end(); ++It)
for (const auto& temp_image : temp_image_cache)
{
if (It->second.first == key)
if (temp_image.second.first == key)
{
keys_to_remove.push_back(It->first);
keys_to_remove.push_back(temp_image.first);
}
}