From c5cd55ffb1c10595fe13d56fae1d06263b16773e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 6 Nov 2023 17:56:30 +1000 Subject: [PATCH] CDImage: clang warning fix --- src/util/cd_image.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/util/cd_image.cpp b/src/util/cd_image.cpp index aa9c3a7c6..b28c41cb6 100644 --- a/src/util/cd_image.cpp +++ b/src/util/cd_image.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin +// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) #include "cd_image.h" @@ -28,23 +28,19 @@ void CDImage::DeinterleaveSubcode(const u8* subcode_in, u8* subcode_out) { std::memset(subcode_out, 0, ALL_SUBCODE_SIZE); - int row = 0; - for (int bitNum = 0; bitNum < 8; bitNum++) + u32 row = 0; + for (u32 bitNum = 0; bitNum < 8; bitNum++) { - for (int nColumn = 0; nColumn < ALL_SUBCODE_SIZE; row++) + for (u32 nColumn = 0; nColumn < ALL_SUBCODE_SIZE; row++) { u32 mask = 0x80; for (int nShift = 0; nShift < 8; nShift++, nColumn++) { - const int n = nShift - bitNum; + const s32 n = static_cast(nShift) - static_cast(bitNum); if (n > 0) - { subcode_out[row] |= static_cast((subcode_in[nColumn] >> n) & mask); - } else - { subcode_out[row] |= static_cast((subcode_in[nColumn] << std::abs(n)) & mask); - } mask >>= 1; } }