Mercurial > mplayer.hg
changeset 10489:b7a6edb6100e
Changed swab32 from macro to inline function, this fixes compilation on alpha (with gcc2.95). Based on patch by KotH
author | alex |
---|---|
date | Sun, 27 Jul 2003 23:02:58 +0000 |
parents | ec04f41e2480 |
children | 37915f569f6d |
files | liba52/bitstream.h |
diffstat | 1 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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