Mercurial > libavcodec.hg
comparison bitstream.h @ 8031:eebc7209c47f libavcodec
Convert asm keyword into __asm__.
Neither the asm() nor the __asm__() keyword is part of the C99
standard, but while GCC accepts the former in C89 syntax, it is not
accepted in C99 unless GNU extensions are turned on (with -fasm). The
latter form is accepted in any syntax as an extension (without
requiring further command-line options).
Sun Studio C99 compiler also does not accept asm() while accepting
__asm__(), albeit reporting warnings that it's not valid C99 syntax.
| author | flameeyes |
|---|---|
| date | Thu, 16 Oct 2008 13:34:09 +0000 |
| parents | c4a4495715dd |
| children | 9281a8a9387a |
comparison
equal
deleted
inserted
replaced
| 8030:a512ac8fa540 | 8031:eebc7209c47f |
|---|---|
| 53 extern const uint8_t ff_reverse[256]; | 53 extern const uint8_t ff_reverse[256]; |
| 54 | 54 |
| 55 #if defined(ARCH_X86) | 55 #if defined(ARCH_X86) |
| 56 // avoid +32 for shift optimization (gcc should do that ...) | 56 // avoid +32 for shift optimization (gcc should do that ...) |
| 57 static inline int32_t NEG_SSR32( int32_t a, int8_t s){ | 57 static inline int32_t NEG_SSR32( int32_t a, int8_t s){ |
| 58 asm ("sarl %1, %0\n\t" | 58 __asm__ ("sarl %1, %0\n\t" |
| 59 : "+r" (a) | 59 : "+r" (a) |
| 60 : "ic" ((uint8_t)(-s)) | 60 : "ic" ((uint8_t)(-s)) |
| 61 ); | 61 ); |
| 62 return a; | 62 return a; |
| 63 } | 63 } |
| 64 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ | 64 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ |
| 65 asm ("shrl %1, %0\n\t" | 65 __asm__ ("shrl %1, %0\n\t" |
| 66 : "+r" (a) | 66 : "+r" (a) |
| 67 : "ic" ((uint8_t)(-s)) | 67 : "ic" ((uint8_t)(-s)) |
| 68 ); | 68 ); |
| 69 return a; | 69 return a; |
| 70 } | 70 } |
| 246 #ifdef ALT_BITSTREAM_WRITER | 246 #ifdef ALT_BITSTREAM_WRITER |
| 247 static inline void put_bits(PutBitContext *s, int n, unsigned int value) | 247 static inline void put_bits(PutBitContext *s, int n, unsigned int value) |
| 248 { | 248 { |
| 249 # ifdef ALIGNED_BITSTREAM_WRITER | 249 # ifdef ALIGNED_BITSTREAM_WRITER |
| 250 # if defined(ARCH_X86) | 250 # if defined(ARCH_X86) |
| 251 asm volatile( | 251 __asm__ volatile( |
| 252 "movl %0, %%ecx \n\t" | 252 "movl %0, %%ecx \n\t" |
| 253 "xorl %%eax, %%eax \n\t" | 253 "xorl %%eax, %%eax \n\t" |
| 254 "shrdl %%cl, %1, %%eax \n\t" | 254 "shrdl %%cl, %1, %%eax \n\t" |
| 255 "shrl %%cl, %1 \n\t" | 255 "shrl %%cl, %1 \n\t" |
| 256 "movl %0, %%ecx \n\t" | 256 "movl %0, %%ecx \n\t" |
| 277 index+= n; | 277 index+= n; |
| 278 s->index= index; | 278 s->index= index; |
| 279 # endif | 279 # endif |
| 280 # else //ALIGNED_BITSTREAM_WRITER | 280 # else //ALIGNED_BITSTREAM_WRITER |
| 281 # if defined(ARCH_X86) | 281 # if defined(ARCH_X86) |
| 282 asm volatile( | 282 __asm__ volatile( |
| 283 "movl $7, %%ecx \n\t" | 283 "movl $7, %%ecx \n\t" |
| 284 "andl %0, %%ecx \n\t" | 284 "andl %0, %%ecx \n\t" |
| 285 "addl %3, %%ecx \n\t" | 285 "addl %3, %%ecx \n\t" |
| 286 "negl %%ecx \n\t" | 286 "negl %%ecx \n\t" |
| 287 "shll %%cl, %1 \n\t" | 287 "shll %%cl, %1 \n\t" |
| 554 name##_bit_count-= 32;\ | 554 name##_bit_count-= 32;\ |
| 555 }\ | 555 }\ |
| 556 | 556 |
| 557 #if defined(ARCH_X86) | 557 #if defined(ARCH_X86) |
| 558 # define SKIP_CACHE(name, gb, num)\ | 558 # define SKIP_CACHE(name, gb, num)\ |
| 559 asm(\ | 559 __asm__(\ |
| 560 "shldl %2, %1, %0 \n\t"\ | 560 "shldl %2, %1, %0 \n\t"\ |
| 561 "shll %2, %1 \n\t"\ | 561 "shll %2, %1 \n\t"\ |
| 562 : "+r" (name##_cache0), "+r" (name##_cache1)\ | 562 : "+r" (name##_cache0), "+r" (name##_cache1)\ |
| 563 : "Ic" ((uint8_t)(num))\ | 563 : "Ic" ((uint8_t)(num))\ |
| 564 ); | 564 ); |
