diff options
Diffstat (limited to 'Utilities/cmliblzma/liblzma/check/crc32_fast.c')
-rw-r--r-- | Utilities/cmliblzma/liblzma/check/crc32_fast.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Utilities/cmliblzma/liblzma/check/crc32_fast.c b/Utilities/cmliblzma/liblzma/check/crc32_fast.c index 94da855..13f65b4 100644 --- a/Utilities/cmliblzma/liblzma/check/crc32_fast.c +++ b/Utilities/cmliblzma/liblzma/check/crc32_fast.c @@ -33,6 +33,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) #endif if (size > 8) { + const uint8_t * limit; + // Fix the alignment, if needed. The if statement above // ensures that this won't read past the end of buf[]. while ((uintptr_t)(buf) & 7) { @@ -41,7 +43,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) } // Calculate the position where to stop. - const uint8_t *const limit = buf + (size & ~(size_t)(7)); + limit = buf + (size & ~(size_t)(7)); // Calculate how many bytes must be calculated separately // before returning the result. @@ -49,6 +51,8 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) // Calculate the CRC32 using the slice-by-eight algorithm. while (buf < limit) { + uint32_t tmp; + crc ^= *(const uint32_t *)(buf); buf += 4; @@ -57,7 +61,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) ^ lzma_crc32_table[5][C(crc)] ^ lzma_crc32_table[4][D(crc)]; - const uint32_t tmp = *(const uint32_t *)(buf); + tmp = *(const uint32_t *)(buf); buf += 4; // At least with some compilers, it is critical for |