c++17: use std::size

This commit is contained in:
scribam 2018-09-05 22:52:31 +02:00 committed by Ivan
parent 7724161c14
commit d7bb59cd99
11 changed files with 21 additions and 21 deletions

View file

@ -139,7 +139,7 @@ void audio_config::on_task()
{
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);
@ -163,7 +163,7 @@ void audio_config::on_task()
}
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);
@ -182,7 +182,7 @@ void audio_config::on_task()
{
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);
@ -212,7 +212,7 @@ void audio_config::on_task()
}
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);
@ -254,14 +254,14 @@ void audio_config::on_task()
// Copy output data (2ch or 8ch)
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];
}
}
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];
}

View file

@ -514,7 +514,7 @@ public:
if (task.stream.discontinuity)
{
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])
{
@ -595,7 +595,7 @@ public:
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)
{

View file

@ -324,7 +324,7 @@ u32 cellGcmGetTiledPitchSize(u32 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]) {
return tiled_pitches[i + 1];
}