aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2020-01-26 13:37:08 +0200
committerLasse Collin <lasse.collin@tukaani.org>2020-02-05 22:00:28 +0200
commitf6d24245349cecfae6ec0d2366fa80716c9f6d37 (patch)
treed03ca7cb6440b35dc40d65fbc63869267762e41e /src
parentxz: Move the setting of flush_needed in file_io.c to a nicer location. (diff)
downloadxz-f6d24245349cecfae6ec0d2366fa80716c9f6d37.tar.xz
xz: Update a comment in file_io.h.
Diffstat (limited to 'src')
-rw-r--r--src/xz/file_io.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/xz/file_io.h b/src/xz/file_io.h
index 6722aef8..32dcad0c 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)];