# HG changeset patch # User alex # Date 1059346978 0 # Node ID b7a6edb6100e1f9ba3472cb9874813c60c74b433 # Parent ec04f41e2480fc376609083b780deff7c72e7b48 Changed swab32 from macro to inline function, this fixes compilation on alpha (with gcc2.95). Based on patch by KotH diff -r ec04f41e2480 -r b7a6edb6100e liba52/bitstream.h --- a/liba52/bitstream.h Sun Jul 27 22:55:25 2003 +0000 +++ b/liba52/bitstream.h Sun Jul 27 23:02:58 2003 +0000 @@ -21,6 +21,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* code from ffmpeg/libavcodec */ +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC_ == 3 && __GNUC_MINOR__ > 0) +# define always_inline __attribute__((always_inline)) inline +#else +# define always_inline inline +#endif + #if defined(__sparc__) || defined(hpux) /* * the alt bitstream reader performs unaligned memory accesses; that doesn't work @@ -36,7 +43,7 @@ # define unaligned32(a) (*(uint32_t*)(a)) #else # ifdef __GNUC__ -static inline uint32_t unaligned32(const void *v) { +static always_inline uint32_t unaligned32(const void *v) { struct Unaligned { uint32_t i; } __attribute__((packed)); @@ -66,7 +73,7 @@ # if defined (__i386__) # define swab32(x) __i386_swab32(x) - static inline const uint32_t __i386_swab32(uint32_t x) + static always_inline const uint32_t __i386_swab32(uint32_t x) { __asm__("bswap %0" : "=r" (x) : "0" (x)); return x; @@ -74,10 +81,12 @@ # else -# define swab32(x)\ -((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | \ - (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3])) - +# define swab32(x) __generic_swab32(x) + static always_inline const uint32_t __generic_swab32(uint32_t x) + { + return ((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | + (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3])); + } # endif #endif