Skip to content

Commit

Permalink
Merge remote-tracking branch 'neheb/strv'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbunkus committed Feb 18, 2024
2 parents 3a015a4 + a6ba9dc commit f8c49c6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/EbmlCrc32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ bool EbmlCrc32::CheckCRC(std::uint32_t inputCRC, const binary *input, std::uint3
crc = s_tab.at(CRC32_INDEX(crc) ^ *input++) ^ CRC32_SHIFTED(crc);

while (length >= 4) {
crc ^= *reinterpret_cast<const std::uint32_t *>(input);
auto buf = reinterpret_cast<const std::uint8_t *>(input);
std::uint32_t chunk{};
for (int idx = 3; idx >= 0; --idx)
chunk = (chunk << 8) | buf[idx];
crc ^= chunk;
crc = s_tab.at(CRC32_INDEX(crc)) ^ CRC32_SHIFTED(crc);
crc = s_tab.at(CRC32_INDEX(crc)) ^ CRC32_SHIFTED(crc);
crc = s_tab.at(CRC32_INDEX(crc)) ^ CRC32_SHIFTED(crc);
Expand Down Expand Up @@ -291,7 +295,11 @@ void EbmlCrc32::Update(const binary *input, std::uint32_t length)
crc = s_tab.at(CRC32_INDEX(crc) ^ *input++) ^ CRC32_SHIFTED(crc);

while (length >= 4) {
crc ^= *reinterpret_cast<const std::uint32_t *>(input);
auto buf = reinterpret_cast<const std::uint8_t *>(input);
std::uint32_t chunk{};
for (int idx = 3; idx >= 0; --idx)
chunk = (chunk << 8) | buf[idx];
crc ^= chunk;
crc = s_tab.at(CRC32_INDEX(crc)) ^ CRC32_SHIFTED(crc);
crc = s_tab.at(CRC32_INDEX(crc)) ^ CRC32_SHIFTED(crc);
crc = s_tab.at(CRC32_INDEX(crc)) ^ CRC32_SHIFTED(crc);
Expand Down

0 comments on commit f8c49c6

Please sign in to comment.