00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #ifndef AVUTIL_X86_BSWAP_H
00025 #define AVUTIL_X86_BSWAP_H
00026
00027 #include <stdint.h>
00028 #include "config.h"
00029 #include "libavutil/attributes.h"
00030
00031 #if HAVE_INLINE_ASM
00032
00033 #if !AV_GCC_VERSION_AT_LEAST(4,1)
00034 #define av_bswap16 av_bswap16
00035 static av_always_inline av_const unsigned av_bswap16(unsigned x)
00036 {
00037 __asm__("rorw $8, %w0" : "+r"(x));
00038 return x;
00039 }
00040 #endif
00041
00042 #if !AV_GCC_VERSION_AT_LEAST(4,5)
00043 #define av_bswap32 av_bswap32
00044 static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
00045 {
00046 __asm__("bswap %0" : "+r" (x));
00047 return x;
00048 }
00049
00050 #if ARCH_X86_64
00051 #define av_bswap64 av_bswap64
00052 static inline uint64_t av_const av_bswap64(uint64_t x)
00053 {
00054 __asm__("bswap %0": "=r" (x) : "0" (x));
00055 return x;
00056 }
00057 #endif
00058 #endif
00059
00060 #endif
00061 #endif