diff options
author | Måns Rullgård <mans@mansr.com> | 2010-02-18 13:40:24 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2010-02-18 13:40:24 +0000 |
commit | 7a6053ef72152c3838c714b9eec95f2dccc5c181 (patch) | |
tree | 8d13f0ff1f8bd0ea9f1dd123aa9f45480dbb0c6e /libavutil/intreadwrite.h | |
parent | 0c76e635f59472e0ed3b79061cb2dcf30faee884 (diff) | |
download | ffmpeg-7a6053ef72152c3838c714b9eec95f2dccc5c181.tar.gz |
Use alias-safe types in AV_COPY/SWAP/ZERO macros
Originally committed as revision 21879 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/intreadwrite.h')
-rw-r--r-- | libavutil/intreadwrite.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h index 52cb309d5a..7565ef711e 100644 --- a/libavutil/intreadwrite.h +++ b/libavutil/intreadwrite.h @@ -428,7 +428,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; * afterwards. */ -#define AV_COPY(n, d, s) (*(uint##n##_t*)(d) = *(const uint##n##_t*)(s)) +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) #ifndef AV_COPY32 # define AV_COPY32(d, s) AV_COPY(32, d, s) @@ -446,13 +447,17 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; } while(0) #endif -#define AV_SWAP(n, a, b) FFSWAP(uint##n##_t, *(uint##n##_t*)(a), *(uint##n##_t*)(b)) +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) #ifndef AV_SWAP64 # define AV_SWAP64(a, b) AV_SWAP(64, a, b) #endif -#define AV_ZERO(n, d) (*(uint##n##_t*)(d) = 0) +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif #ifndef AV_ZERO64 # define AV_ZERO64(d) AV_ZERO(64, d) |