mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 12:31:45 +01:00
c++17: use std::size
This commit is contained in:
parent
7724161c14
commit
d7bb59cd99
@ -174,7 +174,7 @@ public:
|
|||||||
1,
|
1,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
u_int miblen = sizeof(mib) / sizeof(mib[0]);
|
u_int miblen = std::size(mib);
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
size_t size = sizeof(info);
|
size_t size = sizeof(info);
|
||||||
if (sysctl(mib, miblen, &info, &size, NULL, 0))
|
if (sysctl(mib, miblen, &info, &size, NULL, 0))
|
||||||
@ -191,7 +191,7 @@ public:
|
|||||||
sizeof(struct kinfo_proc),
|
sizeof(struct kinfo_proc),
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
u_int miblen = sizeof(mib) / sizeof(mib[0]);
|
u_int miblen = std::size(mib);
|
||||||
|
|
||||||
// get number of structs
|
// get number of structs
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -139,7 +139,7 @@ void audio_config::on_task()
|
|||||||
{
|
{
|
||||||
if (first_mix)
|
if (first_mix)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < (sizeof(buf2ch) / sizeof(float)); i += 2)
|
for (u32 i = 0; i < std::size(buf2ch); i += 2)
|
||||||
{
|
{
|
||||||
step_volume(port);
|
step_volume(port);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void audio_config::on_task()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < (sizeof(buf2ch) / sizeof(float)); i += 2)
|
for (u32 i = 0; i < std::size(buf2ch); i += 2)
|
||||||
{
|
{
|
||||||
step_volume(port);
|
step_volume(port);
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void audio_config::on_task()
|
|||||||
{
|
{
|
||||||
if (first_mix)
|
if (first_mix)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < (sizeof(buf2ch) / sizeof(float)); i += 2)
|
for (u32 i = 0; i < std::size(buf2ch); i += 2)
|
||||||
{
|
{
|
||||||
step_volume(port);
|
step_volume(port);
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ void audio_config::on_task()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < (sizeof(buf2ch) / sizeof(float)); i += 2)
|
for (u32 i = 0; i < std::size(buf2ch); i += 2)
|
||||||
{
|
{
|
||||||
step_volume(port);
|
step_volume(port);
|
||||||
|
|
||||||
@ -254,14 +254,14 @@ void audio_config::on_task()
|
|||||||
// Copy output data (2ch or 8ch)
|
// Copy output data (2ch or 8ch)
|
||||||
if (g_cfg.audio.downmix_to_2ch)
|
if (g_cfg.audio.downmix_to_2ch)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < (sizeof(buf2ch) / sizeof(float)); i++)
|
for (u32 i = 0; i < std::size(buf2ch); i++)
|
||||||
{
|
{
|
||||||
out_buffer[out_pos][i] = buf2ch[i];
|
out_buffer[out_pos][i] = buf2ch[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < (sizeof(buf8ch) / sizeof(float)); i++)
|
for (u32 i = 0; i < std::size(buf8ch); i++)
|
||||||
{
|
{
|
||||||
out_buffer[out_pos][i] = buf8ch[i];
|
out_buffer[out_pos][i] = buf8ch[i];
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ public:
|
|||||||
if (task.stream.discontinuity)
|
if (task.stream.discontinuity)
|
||||||
{
|
{
|
||||||
cellDmux.warning("dmuxSetStream (beginning)");
|
cellDmux.warning("dmuxSetStream (beginning)");
|
||||||
for (u32 i = 0; i < sizeof(esALL) / sizeof(esALL[0]); i++)
|
for (u32 i = 0; i < std::size(esALL); i++)
|
||||||
{
|
{
|
||||||
if (esALL[i])
|
if (esALL[i])
|
||||||
{
|
{
|
||||||
@ -595,7 +595,7 @@ public:
|
|||||||
fmt::throw_exception("dmuxDisableEs: invalid elementary stream" HERE);
|
fmt::throw_exception("dmuxDisableEs: invalid elementary stream" HERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < sizeof(esALL) / sizeof(esALL[0]); i++)
|
for (u32 i = 0; i < std::size(esALL); i++)
|
||||||
{
|
{
|
||||||
if (esALL[i] == &es)
|
if (esALL[i] == &es)
|
||||||
{
|
{
|
||||||
|
@ -324,7 +324,7 @@ u32 cellGcmGetTiledPitchSize(u32 size)
|
|||||||
{
|
{
|
||||||
cellGcmSys.trace("cellGcmGetTiledPitchSize(size=%d)", size);
|
cellGcmSys.trace("cellGcmGetTiledPitchSize(size=%d)", size);
|
||||||
|
|
||||||
for (size_t i = 0; i < sizeof(tiled_pitches) / sizeof(tiled_pitches[0]) - 1; i++) {
|
for (size_t i = 0; i < std::size(tiled_pitches) - 1; i++) {
|
||||||
if (tiled_pitches[i] < size && size <= tiled_pitches[i + 1]) {
|
if (tiled_pitches[i] < size && size <= tiled_pitches[i + 1]) {
|
||||||
return tiled_pitches[i + 1];
|
return tiled_pitches[i + 1];
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ spu_imm_table_t::scale_table_t::scale_table_t()
|
|||||||
|
|
||||||
spu_imm_table_t::spu_imm_table_t()
|
spu_imm_table_t::spu_imm_table_t()
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < sizeof(sldq_pshufb) / sizeof(sldq_pshufb[0]); i++)
|
for (u32 i = 0; i < std::size(sldq_pshufb); i++)
|
||||||
{
|
{
|
||||||
for (u32 j = 0; j < 16; j++)
|
for (u32 j = 0; j < 16; j++)
|
||||||
{
|
{
|
||||||
@ -373,7 +373,7 @@ spu_imm_table_t::spu_imm_table_t()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < sizeof(srdq_pshufb) / sizeof(srdq_pshufb[0]); i++)
|
for (u32 i = 0; i < std::size(srdq_pshufb); i++)
|
||||||
{
|
{
|
||||||
const u32 im = (0u - i) & 0x1f;
|
const u32 im = (0u - i) & 0x1f;
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ spu_imm_table_t::spu_imm_table_t()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i = 0; i < sizeof(rldq_pshufb) / sizeof(rldq_pshufb[0]); i++)
|
for (u32 i = 0; i < std::size(rldq_pshufb); i++)
|
||||||
{
|
{
|
||||||
for (u32 j = 0; j < 16; j++)
|
for (u32 j = 0; j < 16; j++)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ template<typename T> std::string CgBinaryDisasm::GetSrcDisAsm(T src)
|
|||||||
{
|
{
|
||||||
case 0x00: ret += reg_table[0]; break;
|
case 0x00: ret += reg_table[0]; break;
|
||||||
default:
|
default:
|
||||||
if (dst.src_attr_reg_num < sizeof(reg_table) / sizeof(reg_table[0]))
|
if (dst.src_attr_reg_num < std::size(reg_table))
|
||||||
{
|
{
|
||||||
ret += fmt::format("%s[%s]", perspective_correction.c_str(), input_attr_reg.c_str());
|
ret += fmt::format("%s[%s]", perspective_correction.c_str(), input_attr_reg.c_str());
|
||||||
}
|
}
|
||||||
|
@ -444,7 +444,7 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
|
|||||||
properties.has_wpos_input = true;
|
properties.has_wpos_input = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (dst.src_attr_reg_num < sizeof(reg_table) / sizeof(reg_table[0]))
|
if (dst.src_attr_reg_num < std::size(reg_table))
|
||||||
{
|
{
|
||||||
ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), reg_table[dst.src_attr_reg_num]);
|
ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), reg_table[dst.src_attr_reg_num]);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ std::string VertexProgramDecompiler::GetSRC(const u32 n)
|
|||||||
ret += m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "tmp" + std::to_string(src[n].tmp_src));
|
ret += m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "tmp" + std::to_string(src[n].tmp_src));
|
||||||
break;
|
break;
|
||||||
case RSX_VP_REGISTER_TYPE_INPUT:
|
case RSX_VP_REGISTER_TYPE_INPUT:
|
||||||
if (d1.input_src < (sizeof(reg_table) / sizeof(reg_table[0])))
|
if (d1.input_src < std::size(reg_table))
|
||||||
{
|
{
|
||||||
ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), reg_table[d1.input_src], d1.input_src);
|
ret += m_parr.AddParam(PF_PARAM_IN, getFloatTypeName(4), reg_table[d1.input_src], d1.input_src);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ void D3D12FragmentDecompiler::insertOutputs(std::stringstream & OS)
|
|||||||
{ "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" },
|
{ "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" },
|
||||||
};
|
};
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (int i = 0; i < sizeof(table) / sizeof(*table); ++i)
|
for (int i = 0; i < std::size(table); ++i)
|
||||||
{
|
{
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second))
|
if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second))
|
||||||
OS << " " << "float4" << " " << table[i].first << " : SV_TARGET" << idx++ << ";\n";
|
OS << " " << "float4" << " " << table[i].first << " : SV_TARGET" << idx++ << ";\n";
|
||||||
@ -294,7 +294,7 @@ void D3D12FragmentDecompiler::insertMainEnd(std::stringstream & OS)
|
|||||||
|
|
||||||
std::string first_output_name;
|
std::string first_output_name;
|
||||||
OS << " PixelOutput Out = (PixelOutput)0;\n";
|
OS << " PixelOutput Out = (PixelOutput)0;\n";
|
||||||
for (int i = 0; i < sizeof(table) / sizeof(*table); ++i)
|
for (int i = 0; i < std::size(table); ++i)
|
||||||
{
|
{
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second))
|
if (m_parr.HasParam(PF_PARAM_NONE, "float4", table[i].second))
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ void GLFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
|
|||||||
{ "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" },
|
{ "ocol3", m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS ? "r4" : "h8" },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < sizeof(table) / sizeof(*table); ++i)
|
for (int i = 0; i < std::size(table); ++i)
|
||||||
{
|
{
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", table[i].second))
|
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", table[i].second))
|
||||||
OS << "layout(location=" << i << ") out vec4 " << table[i].first << ";\n";
|
OS << "layout(location=" << i << ") out vec4 " << table[i].first << ";\n";
|
||||||
|
@ -93,7 +93,7 @@ void VKFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
|
|||||||
|
|
||||||
//NOTE: We do not skip outputs, the only possible combinations are a(0), b(0), ab(0,1), abc(0,1,2), abcd(0,1,2,3)
|
//NOTE: We do not skip outputs, the only possible combinations are a(0), b(0), ab(0,1), abc(0,1,2), abcd(0,1,2,3)
|
||||||
u8 output_index = 0;
|
u8 output_index = 0;
|
||||||
for (int i = 0; i < sizeof(table) / sizeof(*table); ++i)
|
for (int i = 0; i < std::size(table); ++i)
|
||||||
{
|
{
|
||||||
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", table[i].second))
|
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", table[i].second))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user