# HG changeset patch # User bellard # Date 1023803007 0 # Node ID 873b9075d853c7d1133eaeb18df97145c9608e1a # Parent de11e138a66181c07c577d560d992e9e1122ae53 move unaligned access macros to dsputil.h - added unaligned 32 bit store diff -r de11e138a661 -r 873b9075d853 dsputil.c --- a/dsputil.c Tue Jun 11 13:42:18 2002 +0000 +++ b/dsputil.c Tue Jun 11 13:43:27 2002 +0000 @@ -252,21 +252,6 @@ } } -#ifdef __GNUC__ - -struct unaligned_64 { uint64_t l; } __attribute__((packed)); -struct unaligned_32 { uint32_t l; } __attribute__((packed)); - -#define LD32(a) (((const struct unaligned_32 *) (a))->l) -#define LD64(a) (((const struct unaligned_64 *) (a))->l) - -#else /* __GNUC__ */ - -#define LD32(a) (*((uint32_t*)(a))) -#define LD64(a) (*((uint64_t*)(a))) - -#endif /* !__GNUC__ */ - #if 0 #define PIXOP2(OPNAME, OP) \ diff -r de11e138a661 -r 873b9075d853 dsputil.h --- a/dsputil.h Tue Jun 11 13:42:18 2002 +0000 +++ b/dsputil.h Tue Jun 11 13:43:27 2002 +0000 @@ -168,6 +168,25 @@ #endif +#ifdef __GNUC__ + +struct unaligned_64 { uint64_t l; } __attribute__((packed)); +struct unaligned_32 { uint32_t l; } __attribute__((packed)); + +#define LD32(a) (((const struct unaligned_32 *) (a))->l) +#define LD64(a) (((const struct unaligned_64 *) (a))->l) + +#define ST32(a, b) (((struct unaligned_32 *) (a))->l) = (b) + +#else /* __GNUC__ */ + +#define LD32(a) (*((uint32_t*)(a))) +#define LD64(a) (*((uint64_t*)(a))) + +#define ST32(a, b) *((uint32_t*)(a)) = (b) + +#endif /* !__GNUC__ */ + /* PSNR */ void get_psnr(UINT8 *orig_image[3], UINT8 *coded_image[3], int orig_linesize[3], int coded_linesize,