diff options
Diffstat (limited to 'libavutil/intreadwrite.h')
-rw-r--r-- | libavutil/intreadwrite.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h index 085aaad..d6c1b67 100644 --- a/libavutil/intreadwrite.h +++ b/libavutil/intreadwrite.h @@ -28,23 +28,23 @@ struct unaligned_64 { uint64_t l; } __attribute__((packed)); struct unaligned_32 { uint32_t l; } __attribute__((packed)); struct unaligned_16 { uint16_t l; } __attribute__((packed)); -#define LD16(a) (((const struct unaligned_16 *) (a))->l) -#define LD32(a) (((const struct unaligned_32 *) (a))->l) -#define LD64(a) (((const struct unaligned_64 *) (a))->l) +#define AV_RN16(a) (((const struct unaligned_16 *) (a))->l) +#define AV_RN32(a) (((const struct unaligned_32 *) (a))->l) +#define AV_RN64(a) (((const struct unaligned_64 *) (a))->l) -#define ST16(a, b) (((struct unaligned_16 *) (a))->l) = (b) -#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) -#define ST64(a, b) (((struct unaligned_64 *) (a))->l) = (b) +#define AV_WN16(a, b) (((struct unaligned_16 *) (a))->l) = (b) +#define AV_WN32(a, b) (((struct unaligned_32 *) (a))->l) = (b) +#define AV_WN64(a, b) (((struct unaligned_64 *) (a))->l) = (b) #else /* __GNUC__ */ -#define LD16(a) (*((uint16_t*)(a))) -#define LD32(a) (*((uint32_t*)(a))) -#define LD64(a) (*((uint64_t*)(a))) +#define AV_RN16(a) (*((uint16_t*)(a))) +#define AV_RN32(a) (*((uint32_t*)(a))) +#define AV_RN64(a) (*((uint64_t*)(a))) -#define ST16(a, b) *((uint16_t*)(a)) = (b) -#define ST32(a, b) *((uint32_t*)(a)) = (b) -#define ST64(a, b) *((uint64_t*)(a)) = (b) +#define AV_WN16(a, b) *((uint16_t*)(a)) = (b) +#define AV_WN32(a, b) *((uint32_t*)(a)) = (b) +#define AV_WN64(a, b) *((uint64_t*)(a)) = (b) #endif /* !__GNUC__ */ @@ -57,17 +57,17 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); #ifdef HAVE_FAST_UNALIGNED # ifdef WORDS_BIGENDIAN -# define AV_RB16(x) LD16(x) -# define AV_WB16(p, d) ST16(p, d) +# define AV_RB16(x) AV_RN16(x) +# define AV_WB16(p, d) AV_WN16(p, d) -# define AV_RL16(x) bswap_16(LD16(x)) -# define AV_WL16(p, d) ST16(p, bswap_16(d)) +# define AV_RL16(x) bswap_16(AV_RN16(x)) +# define AV_WL16(p, d) AV_WN16(p, bswap_16(d)) # else /* WORDS_BIGENDIAN */ -# define AV_RB16(x) bswap_16(LD16(x)) -# define AV_WB16(p, d) ST16(p, bswap_16(d)) +# define AV_RB16(x) bswap_16(AV_RN16(x)) +# define AV_WB16(p, d) AV_WN16(p, bswap_16(d)) -# define AV_RL16(x) LD16(x) -# define AV_WL16(p, d) ST16(p, d) +# define AV_RL16(x) AV_RN16(x) +# define AV_WL16(p, d) AV_WN16(p, d) # endif #else /* HAVE_FAST_UNALIGNED */ #define AV_RB16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) @@ -100,17 +100,17 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); #ifdef HAVE_FAST_UNALIGNED # ifdef WORDS_BIGENDIAN -# define AV_RB32(x) LD32(x) -# define AV_WB32(p, d) ST32(p, d) +# define AV_RB32(x) AV_RN32(x) +# define AV_WB32(p, d) AV_WN32(p, d) -# define AV_RL32(x) bswap_32(LD32(x)) -# define AV_WL32(p, d) ST32(p, bswap_32(d)) +# define AV_RL32(x) bswap_32(AV_RN32(x)) +# define AV_WL32(p, d) AV_WN32(p, bswap_32(d)) # else /* WORDS_BIGENDIAN */ -# define AV_RB32(x) bswap_32(LD32(x)) -# define AV_WB32(p, d) ST32(p, bswap_32(d)) +# define AV_RB32(x) bswap_32(AV_RN32(x)) +# define AV_WB32(p, d) AV_WN32(p, bswap_32(d)) -# define AV_RL32(x) LD32(x) -# define AV_WL32(p, d) ST32(p, d) +# define AV_RL32(x) AV_RN32(x) +# define AV_WL32(p, d) AV_WN32(p, d) # endif #else /* HAVE_FAST_UNALIGNED */ #define AV_RB32(x) ((((uint8_t*)(x))[0] << 24) | \ @@ -136,17 +136,17 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed)); #ifdef HAVE_FAST_UNALIGNED # ifdef WORDS_BIGENDIAN -# define AV_RB64(x) LD64(x) -# define AV_WB64(p, d) ST64(p, d) +# define AV_RB64(x) AV_RN64(x) +# define AV_WB64(p, d) AV_WN64(p, d) -# define AV_RL64(x) bswap_64(LD64(x)) -# define AV_WL64(p, d) ST64(p, bswap_64(d)) +# define AV_RL64(x) bswap_64(AV_RN64(x)) +# define AV_WL64(p, d) AV_WN64(p, bswap_64(d)) # else /* WORDS_BIGENDIAN */ -# define AV_RB64(x) bswap_64(LD64(x)) -# define AV_WB64(p, d) ST64(p, bswap_64(d)) +# define AV_RB64(x) bswap_64(AV_RN64(x)) +# define AV_WB64(p, d) AV_WN64(p, bswap_64(d)) -# define AV_RL64(x) LD64(x) -# define AV_WL64(p, d) ST64(p, d) +# define AV_RL64(x) AV_RN64(x) +# define AV_WL64(p, d) AV_WN64(p, d) # endif #else /* HAVE_FAST_UNALIGNED */ #define AV_RB64(x) (((uint64_t)((uint8_t*)(x))[0] << 56) | \ |