summaryrefslogtreecommitdiff
path: root/libavcodec/x86/mathops.h
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-02-17 23:58:59 +0000
committerMåns Rullgård <mans@mansr.com>2010-02-17 23:58:59 +0000
commit5e46be96f86597f31f53a94d1704ffb8299bec32 (patch)
tree9cc09b7172fd4098dcb2ae8c7b78a8ab39034aa0 /libavcodec/x86/mathops.h
parentdc9e57a878107be304398387dc5e846346ef70c6 (diff)
Move NEG_[US]SR32 macros to mathops.h
Originally committed as revision 21873 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/x86/mathops.h')
-rw-r--r--libavcodec/x86/mathops.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 691a200fd4..010cfb70bb 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 */