Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Oct 14, 2023
1 parent 7482980 commit 61ee1bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/C4AudioSystemSdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,12 @@ T *C4AudioSystemSdl::LoadSampleCheckMpegLayer3Header(const SampleLoadFunc<T> loa
// According to http://www.idea2ic.com/File_Formats/MPEG%20Audio%20Frame%20Header.pdf
// Maximum possible frame size = 144 * max bit rate / min sample rate + padding
// chosen values are limited to layer 3
constexpr std::size_t MaxFrameSize = 144 * 320'000 / 8'000 + 1;
static constexpr std::size_t MaxFrameSize{144 * 320'000 / 8'000 + 1};

std::span data{reinterpret_cast<const std::byte *>(buf), size};
for (std::size_t i = 0, limit = std::min(data.size(), MaxFrameSize); i < limit - 4; ++i)
const std::span data{reinterpret_cast<const std::byte *>(buf), size};
const std::size_t limit{std::min(data.size(), MaxFrameSize)};

for (std::size_t i{0}; i < limit - 4; ++i)
{
// first 8 of 11 frame sync bits
if (data[i] != std::byte{0xFF}) continue;
Expand Down

0 comments on commit 61ee1bd

Please sign in to comment.