# HG changeset patch # User mru # Date 1266451139 0 # Node ID cd8a77473dd16c60020caccb43d04b8a46696775 # Parent f1b38a8588b2d843f2d741e8113e08a8abd6db12 Move NEG_[US]SR32 macros to mathops.h diff -r f1b38a8588b2 -r cd8a77473dd1 get_bits.h --- a/get_bits.h Wed Feb 17 23:26:48 2010 +0000 +++ b/get_bits.h Wed Feb 17 23:58:59 2010 +0000 @@ -49,27 +49,6 @@ # endif #endif -#if ARCH_X86 -// avoid +32 for shift optimization (gcc should do that ...) -static inline int32_t NEG_SSR32( int32_t a, int8_t s){ - __asm__ ("sarl %1, %0\n\t" - : "+r" (a) - : "ic" ((uint8_t)(-s)) - ); - return a; -} -static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ - __asm__ ("shrl %1, %0\n\t" - : "+r" (a) - : "ic" ((uint8_t)(-s)) - ); - return a; -} -#else -# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) -# define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s))) -#endif - /* bit input */ /* buffer, buffer_end and size_in_bits must be present and used by every reader */ typedef struct GetBitContext { diff -r f1b38a8588b2 -r cd8a77473dd1 mathops.h --- a/mathops.h Wed Feb 17 23:26:48 2010 +0000 +++ b/mathops.h Wed Feb 17 23:58:59 2010 +0000 @@ -131,5 +131,13 @@ } #endif +#ifndef NEG_SSR32 +# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) +#endif + +#ifndef NEG_USR32 +# define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s))) +#endif + #endif /* AVCODEC_MATHOPS_H */ diff -r f1b38a8588b2 -r cd8a77473dd1 x86/mathops.h --- a/x86/mathops.h Wed Feb 17 23:26:48 2010 +0000 +++ b/x86/mathops.h Wed Feb 17 23:58:59 2010 +0000 @@ -78,4 +78,23 @@ ); #endif +// avoid +32 for shift optimization (gcc should do that ...) +#define NEG_SSR32 NEG_SSR32 +static inline int32_t NEG_SSR32( int32_t a, int8_t s){ + __asm__ ("sarl %1, %0\n\t" + : "+r" (a) + : "ic" ((uint8_t)(-s)) + ); + return a; +} + +#define NEG_USR32 NEG_USR32 +static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ + __asm__ ("shrl %1, %0\n\t" + : "+r" (a) + : "ic" ((uint8_t)(-s)) + ); + return a; +} + #endif /* AVCODEC_X86_MATHOPS_H */