# HG changeset patch # User mru # Date 1266500424 0 # Node ID 8af0a7ac848212ba6b8895ca5acf38d8097362bb # Parent 5e375940e1955f87a1201da7d7cad7671095d064 Use alias-safe types in AV_COPY/SWAP/ZERO macros diff -r 5e375940e195 -r 8af0a7ac8482 intreadwrite.h --- a/intreadwrite.h Thu Feb 18 13:40:21 2010 +0000 +++ b/intreadwrite.h Thu Feb 18 13:40:24 2010 +0000 @@ -428,7 +428,8 @@ * 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 @@ } 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)