aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2019-12-31 00:29:48 +0200
committerLasse Collin <lasse.collin@tukaani.org>2019-12-31 00:29:48 +0200
commit5e78fcbf2eb21936022c9c5c3625d4da76f4b241 (patch)
tree8f652d805e340c55bc2b3c60ab7a9e21b0f43ea5 /src/liblzma
parentRevise tuklib_integer.h and .m4. (diff)
downloadxz-5e78fcbf2eb21936022c9c5c3625d4da76f4b241.tar.xz
Rename read32ne to aligned_read32ne, and similarly for the others.
Using the aligned methods requires more care to ensure that the address really is aligned, so it's nicer if the aligned methods are prefixed. The next commit will remove the unaligned_ prefix from the unaligned methods which in liblzma are used in more places than the aligned ones.
Diffstat (limited to 'src/liblzma')
-rw-r--r--src/liblzma/check/crc32_fast.c4
-rw-r--r--src/liblzma/check/crc64_fast.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/liblzma/check/crc32_fast.c b/src/liblzma/check/crc32_fast.c
index 3de02638..eed73505 100644
--- a/src/liblzma/check/crc32_fast.c
+++ b/src/liblzma/check/crc32_fast.c
@@ -49,7 +49,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
// Calculate the CRC32 using the slice-by-eight algorithm.
while (buf < limit) {
- crc ^= *(const uint32_t *)(buf);
+ crc ^= aligned_read32ne(buf);
buf += 4;
crc = lzma_crc32_table[7][A(crc)]
@@ -57,7 +57,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);
+ const uint32_t tmp = aligned_read32ne(buf);
buf += 4;
// At least with some compilers, it is critical for
diff --git a/src/liblzma/check/crc64_fast.c b/src/liblzma/check/crc64_fast.c
index 52af29ed..8af54cda 100644
--- a/src/liblzma/check/crc64_fast.c
+++ b/src/liblzma/check/crc64_fast.c
@@ -47,9 +47,9 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
while (buf < limit) {
#ifdef WORDS_BIGENDIAN
const uint32_t tmp = (crc >> 32)
- ^ *(const uint32_t *)(buf);
+ ^ aligned_read32ne(buf);
#else
- const uint32_t tmp = crc ^ *(const uint32_t *)(buf);
+ const uint32_t tmp = crc ^ aligned_read32ne(buf);
#endif
buf += 4;