aboutsummaryrefslogtreecommitdiff
path: root/archival/libarchive/decompress_unxz.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-15 20:22:25 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-15 20:22:25 +0200
commit2c1258c620c5847649367394439cc10d0331d211 (patch)
treea0464536ff4534783af8cc68249e80b358101d31 /archival/libarchive/decompress_unxz.c
parent08dfafc43757c42971b4bc3709ae7a5cda7c21fb (diff)
downloadbusybox-2c1258c620c5847649367394439cc10d0331d211.tar.gz
Move get_unaligned_le32() macros to platform.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libarchive/decompress_unxz.c')
-rw-r--r--archival/libarchive/decompress_unxz.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/archival/libarchive/decompress_unxz.c b/archival/libarchive/decompress_unxz.c
index cd32cc745..350e5358a 100644
--- a/archival/libarchive/decompress_unxz.c
+++ b/archival/libarchive/decompress_unxz.c
@@ -27,11 +27,17 @@ static uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
return ~crc32_block_endian0(~crc, buf, size, global_crc32_table);
}
-/* We use arch-optimized unaligned accessors */
-#define get_unaligned_le32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_LE32(v); })
-#define get_unaligned_be32(buf) ({ uint32_t v; move_from_unaligned32(v, buf); SWAP_BE32(v); })
-#define put_unaligned_le32(val, buf) move_to_unaligned32(buf, SWAP_LE32(val))
-#define put_unaligned_be32(val, buf) move_to_unaligned32(buf, SWAP_BE32(val))
+/* We use arch-optimized unaligned fixed-endian accessors.
+ * They have been moved to libbb (proved to be useful elsewhere as well),
+ * just check that we have them defined:
+ */
+#if !defined(get_unaligned_le32) \
+ || !defined(get_unaligned_be32) \
+ || !defined(put_unaligned_le32) \
+ || !defined(put_unaligned_be32)
+# error get_unaligned_le32 accessors are not defined
+#endif
+#define get_le32(p) (*(uint32_t*)(p))
#include "unxz/xz_dec_bcj.c"
#include "unxz/xz_dec_lzma2.c"