OSDN Git Service

Add alias-safe union typedefs
authorMåns Rullgård <mans@mansr.com>
Thu, 18 Feb 2010 13:40:19 +0000 (13:40 +0000)
committerMåns Rullgård <mans@mansr.com>
Thu, 18 Feb 2010 13:40:19 +0000 (13:40 +0000)
Originally committed as revision 21877 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/intreadwrite.h

index 81ba82d..57fa83c 100644 (file)
 #include <stdint.h>
 #include "config.h"
 #include "bswap.h"
+#include "common.h"
+
+typedef union {
+    uint64_t u64;
+    uint32_t u32[2];
+    uint16_t u16[4];
+    uint8_t  u8 [8];
+    double   f64;
+    float    f32[2];
+} av_alias av_alias64;
+
+typedef union {
+    uint32_t u32;
+    uint16_t u16[2];
+    uint8_t  u8 [4];
+    float    f32;
+} av_alias av_alias32;
+
+typedef union {
+    uint16_t u16;
+    uint8_t  u8 [2];
+} av_alias av_alias16;
 
 /*
  * Arch-specific headers can provide any combination of