mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
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
This commit is contained in:
parent
b4547c12fc
commit
b7c68f8ad3
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user