# HG changeset patch # User michaelni # Date 1021772993 0 # Node ID d7008d1c5bd0f3ec6d325866605afc32b1a2c7eb # Parent 8ca5969535ee4f74e82f4f67fda6944567e045de fixing alignment for alignment picky cpus diff -r 8ca5969535ee -r d7008d1c5bd0 dsputil.c --- 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) \