From 63c2e32e207d31ecadd9022e1d7cd705c9febac8 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 15 Sep 2018 15:21:06 +0200 Subject: Port #4182 from Citra: "Prefix all size_t with std::" --- src/audio_core/codec.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/audio_core/codec.cpp') diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp index c3021403f..454de798b 100644 --- a/src/audio_core/codec.cpp +++ b/src/audio_core/codec.cpp @@ -8,27 +8,27 @@ namespace AudioCore::Codec { -std::vector DecodeADPCM(const u8* const data, size_t size, const ADPCM_Coeff& coeff, +std::vector DecodeADPCM(const u8* const data, std::size_t size, const ADPCM_Coeff& coeff, ADPCMState& state) { // GC-ADPCM with scale factor and variable coefficients. // Frames are 8 bytes long containing 14 samples each. // Samples are 4 bits (one nibble) long. - constexpr size_t FRAME_LEN = 8; - constexpr size_t SAMPLES_PER_FRAME = 14; + constexpr std::size_t FRAME_LEN = 8; + constexpr std::size_t SAMPLES_PER_FRAME = 14; constexpr std::array SIGNED_NIBBLES = { {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}}; - const size_t sample_count = (size / FRAME_LEN) * SAMPLES_PER_FRAME; - const size_t ret_size = + const std::size_t sample_count = (size / FRAME_LEN) * SAMPLES_PER_FRAME; + const std::size_t ret_size = sample_count % 2 == 0 ? sample_count : sample_count + 1; // Ensure multiple of two. std::vector ret(ret_size); int yn1 = state.yn1, yn2 = state.yn2; - const size_t NUM_FRAMES = + const std::size_t NUM_FRAMES = (sample_count + (SAMPLES_PER_FRAME - 1)) / SAMPLES_PER_FRAME; // Round up. - for (size_t framei = 0; framei < NUM_FRAMES; framei++) { + for (std::size_t framei = 0; framei < NUM_FRAMES; framei++) { const int frame_header = data[framei * FRAME_LEN]; const int scale = 1 << (frame_header & 0xF); const int idx = (frame_header >> 4) & 0x7; @@ -53,9 +53,9 @@ std::vector DecodeADPCM(const u8* const data, size_t size, const ADPCM_Coef return static_cast(val); }; - size_t outputi = framei * SAMPLES_PER_FRAME; - size_t datai = framei * FRAME_LEN + 1; - for (size_t i = 0; i < SAMPLES_PER_FRAME && outputi < sample_count; i += 2) { + std::size_t outputi = framei * SAMPLES_PER_FRAME; + std::size_t datai = framei * FRAME_LEN + 1; + for (std::size_t i = 0; i < SAMPLES_PER_FRAME && outputi < sample_count; i += 2) { const s16 sample1 = decode_sample(SIGNED_NIBBLES[data[datai] >> 4]); ret[outputi] = sample1; outputi++; -- cgit v1.2.3