mirror of
https://github.com/sanni/cartreader.git
synced 2024-12-04 10:14:17 +01:00
Fix CRC32 calculation
This commit is contained in:
parent
e19dcc4ee4
commit
24c5957993
@ -548,7 +548,7 @@ uint32_t updateCRC(const byte *buffer, size_t length, uint32_t crc) {
|
|||||||
|
|
||||||
uint32_t calculateCRC(const byte *buffer, size_t length) {
|
uint32_t calculateCRC(const byte *buffer, size_t length) {
|
||||||
uint32_t crc = 0xFFFFFFFF;
|
uint32_t crc = 0xFFFFFFFF;
|
||||||
updateCRC(buffer, length, crc);
|
crc = updateCRC(buffer, length, crc);
|
||||||
return ~crc;
|
return ~crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,7 +557,7 @@ uint32_t calculateCRC(FsFile &infile) {
|
|||||||
uint32_t crc = 0xFFFFFFFF;
|
uint32_t crc = 0xFFFFFFFF;
|
||||||
|
|
||||||
while((byte_count = infile.read(sdBuffer, sizeof(sdBuffer))) != 0) {
|
while((byte_count = infile.read(sdBuffer, sizeof(sdBuffer))) != 0) {
|
||||||
updateCRC(sdBuffer, byte_count, crc);
|
crc = updateCRC(sdBuffer, byte_count, crc);
|
||||||
}
|
}
|
||||||
return ~crc;
|
return ~crc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user