diff options
author | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-07-27 23:02:58 +0000 |
---|---|---|
committer | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-07-27 23:02:58 +0000 |
commit | b7c68f8ad32ad9e06c686ec42c05c73163eac904 (patch) | |
tree | 42847cf5d743f761c34c411c5b984d5289abeab8 /liba52/bitstream.h | |
parent | b4547c12fc16e4b2fcb4c547beeeee5d8a427615 (diff) | |
download | mpv-b7c68f8ad32ad9e06c686ec42c05c73163eac904.tar.bz2 mpv-b7c68f8ad32ad9e06c686ec42c05c73163eac904.tar.xz |
Changed swab32 from macro to inline function, this fixes compilation on alpha (with gcc2.95). Based on patch by KotH
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10490 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'liba52/bitstream.h')
-rw-r--r-- | liba52/bitstream.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/liba52/bitstream.h b/liba52/bitstream.h index 5a3ac9eb42..42af8a64e5 100644 --- a/liba52/bitstream.h +++ b/liba52/bitstream.h @@ -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 @@ static inline uint32_t unaligned32(const void *v) { # 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 @@ static inline uint32_t unaligned32(const void *v) { # 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 |