From 4ae9ab70cd3214395756435d13d8d000368ca2cb Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sun, 26 Jan 2020 13:37:08 +0200 Subject: [PATCH] xz: Update a comment in file_io.h. --- src/xz/file_io.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xz/file_io.h b/src/xz/file_io.h index ff6fb80a..4b4418d6 100644 --- a/src/xz/file_io.h +++ b/src/xz/file_io.h @@ -20,7 +20,10 @@ /// is_sparse() accesses the buffer as uint64_t for maximum speed. -/// Use an union to make sure that the buffer is properly aligned. +/// The u32 and u64 members must only be access through this union +/// to avoid strict aliasing violations. Taking a pointer of u8 +/// should be fine as long as uint8_t maps to unsigned char which +/// can alias anything. typedef union { uint8_t u8[IO_BUFFER_SIZE]; uint32_t u32[IO_BUFFER_SIZE / sizeof(uint32_t)];