From 5e46be96f86597f31f53a94d1704ffb8299bec32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Date: Wed, 17 Feb 2010 23:58:59 +0000 Subject: [PATCH] Move NEG_[US]SR32 macros to mathops.h Originally committed as revision 21873 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/get_bits.h | 21 --------------------- libavcodec/mathops.h | 8 ++++++++ libavcodec/x86/mathops.h | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h index 7da954843..bb40ff4f3 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h @@ -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 --git a/libavcodec/mathops.h b/libavcodec/mathops.h index e33f3bf30..85eac484e 100644 --- a/libavcodec/mathops.h +++ b/libavcodec/mathops.h @@ -131,5 +131,13 @@ if ((y) < (x)) {\ } #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 --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 691a200fd..010cfb70b 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -78,4 +78,23 @@ __asm__ volatile(\ ); #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 */ -- 2.11.0