fix: bucles cap a ranges algorithms (38 troballes)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
@@ -14,11 +15,10 @@ namespace Resource {
|
||||
|
||||
// Calculate CRC32 checksum for data verification
|
||||
auto Pack::calculateChecksum(const std::vector<uint8_t>& data) -> uint32_t { // NOLINT(readability-convert-member-functions-to-static)
|
||||
uint32_t checksum = 0x12345678;
|
||||
for (unsigned char byte : data) {
|
||||
checksum = ((checksum << 5) + checksum) + byte;
|
||||
}
|
||||
return checksum;
|
||||
return std::accumulate(data.begin(), data.end(), uint32_t{0x12345678},
|
||||
[](uint32_t acc, unsigned char byte) -> uint32_t {
|
||||
return ((acc << 5) + acc) + byte;
|
||||
});
|
||||
}
|
||||
|
||||
// XOR encryption (symmetric - same function for encrypt/decrypt)
|
||||
|
||||
Reference in New Issue
Block a user