Hopefully fix "will break strict-aliasing rules" warning for get_le32
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 10 Aug 2017 10:40:48 +0000 (12:40 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 10 Aug 2017 10:40:48 +0000 (12:40 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/platform.h

index b81c59d4ea5da692f8b108993a2e393933e6cd62..c365d5c8c15e4014a96fccc66e6a2c12769d14fd 100644 (file)
@@ -260,6 +260,11 @@ typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
 #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))
 
+/* unxz needs an aligned fixed-endian accessor.
+ * (however, the compiler does not realize it's aligned, the cast is still necessary)
+ */
+#define get_le32(u32p) ({ uint32_t v = *(bb__aliased_uint32_t*)(u32p); SWAP_LE32(v); })
+
 
 /* ---- Size-saving "small" ints (arch-dependent) ----------- */