changeset 398:d7008d1c5bd0 libavcodec

fixing alignment for alignment picky cpus
author michaelni
date Sun, 19 May 2002 01:49:53 +0000
parents 8ca5969535ee
children 64247fd53524
files dsputil.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dsputil.c	Sat May 18 23:05:19 2002 +0000
+++ b/dsputil.c	Sun May 19 01:49:53 2002 +0000
@@ -249,11 +249,21 @@
     }
 }
 
-//FIXME someone with a alignemtent picky cpu should change these
+#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) \