[FFmpeg-devel] [PATCH 3/7] Add alias-safe union typedefs

Mans Rullgard mans
Fri Jan 29 03:12:10 CET 2010


---
 libavutil/intreadwrite.h |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index bdc3c43..8a4ef72 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -23,6 +23,24 @@
 #include "config.h"
 #include "bswap.h"
 
+typedef union {
+    uint64_t u64;
+    uint32_t u32[2];
+    uint16_t u16[4];
+    uint8_t  u8 [8];
+} av_alias ff_alias64;
+
+typedef union {
+    uint32_t u32;
+    uint16_t u16[2];
+    uint8_t  u8 [4];
+} av_alias ff_alias32;
+
+typedef union {
+    uint16_t u16;
+    uint8_t  u8 [2];
+} av_alias ff_alias16;
+
 /*
  * Arch-specific headers can provide any combination of
  * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros.
-- 
1.6.6.1




More information about the ffmpeg-devel mailing list