aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-02-18 13:40:21 +0000
committerMåns Rullgård <mans@mansr.com>2010-02-18 13:40:21 +0000
commit0c76e635f59472e0ed3b79061cb2dcf30faee884 (patch)
tree428a7ffd02300141194f3f6eed4b2b833b94a9cc
parentd10458c9e27a5901ab2bc74059fde99f7ff3c267 (diff)
downloadffmpeg-0c76e635f59472e0ed3b79061cb2dcf30faee884.tar.gz
Use alias-safe types in AV_[RW] macros
Originally committed as revision 21878 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavutil/intreadwrite.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index 57fa83c3a6..52cb309d5a 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -177,12 +177,12 @@ typedef union {
#if HAVE_ATTRIBUTE_PACKED
-struct unaligned_64 { uint64_t l; } __attribute__((packed));
-struct unaligned_32 { uint32_t l; } __attribute__((packed));
-struct unaligned_16 { uint16_t l; } __attribute__((packed));
+union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
+union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
+union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
-# define AV_RN(s, p) (((const struct unaligned_##s *) (p))->l)
-# define AV_WN(s, p, v) ((((struct unaligned_##s *) (p))->l) = (v))
+# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l)
+# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v))
#elif defined(__DECC)
@@ -191,8 +191,8 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
#elif HAVE_FAST_UNALIGNED
-# define AV_RN(s, p) (*((const uint##s##_t*)(p)))
-# define AV_WN(s, p, v) (*((uint##s##_t*)(p)) = (v))
+# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s)
+# define AV_WN(s, p, v) (((uint##s##_t*)(p))->u##s = (v))
#else