Mercurial > libavutil.hg
comparison bswap.h @ 481:f4187c1c15a6 libavutil
Reapply r12489: Add pure, const and malloc attributes to proper functions
in libavutil.
Fix a compilation failure in r12489.
author | zuxy |
---|---|
date | Wed, 19 Mar 2008 06:17:43 +0000 |
parents | c4ce55ea2c04 |
children | 73bbedff8e92 |
comparison
equal
deleted
inserted
replaced
480:c4ce55ea2c04 | 481:f4187c1c15a6 |
---|---|
32 | 32 |
33 #ifdef HAVE_BYTESWAP_H | 33 #ifdef HAVE_BYTESWAP_H |
34 #include <byteswap.h> | 34 #include <byteswap.h> |
35 #else | 35 #else |
36 | 36 |
37 static av_always_inline uint16_t bswap_16(uint16_t x) | 37 static av_always_inline av_const uint16_t bswap_16(uint16_t x) |
38 { | 38 { |
39 #if defined(ARCH_X86) | 39 #if defined(ARCH_X86) |
40 asm("rorw $8, %0" : "+r"(x)); | 40 asm("rorw $8, %0" : "+r"(x)); |
41 #elif defined(ARCH_SH4) | 41 #elif defined(ARCH_SH4) |
42 asm("swap.b %0,%0" : "=r"(x) : "0"(x)); | 42 asm("swap.b %0,%0" : "=r"(x) : "0"(x)); |
44 x= (x>>8) | (x<<8); | 44 x= (x>>8) | (x<<8); |
45 #endif | 45 #endif |
46 return x; | 46 return x; |
47 } | 47 } |
48 | 48 |
49 static av_always_inline uint32_t bswap_32(uint32_t x) | 49 static av_always_inline av_const uint32_t bswap_32(uint32_t x) |
50 { | 50 { |
51 #if defined(ARCH_X86) | 51 #if defined(ARCH_X86) |
52 #ifdef HAVE_BSWAP | 52 #ifdef HAVE_BSWAP |
53 asm("bswap %0" : "+r" (x)); | 53 asm("bswap %0" : "+r" (x)); |
54 #else | 54 #else |
81 x= (x>>16) | (x<<16); | 81 x= (x>>16) | (x<<16); |
82 #endif | 82 #endif |
83 return x; | 83 return x; |
84 } | 84 } |
85 | 85 |
86 static inline uint64_t bswap_64(uint64_t x) | 86 static inline uint64_t av_const bswap_64(uint64_t x) |
87 { | 87 { |
88 #if 0 | 88 #if 0 |
89 x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); | 89 x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); |
90 x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); | 90 x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); |
91 return (x>>32) | (x<<32); | 91 return (x>>32) | (x<<32); |