mathops: use MUL64 macro where it forms part of other ops
authorMans Rullgard <mans@mansr.com>
Sat, 4 Jun 2011 16:52:30 +0000 (17:52 +0100)
committerMans Rullgard <mans@mansr.com>
Sat, 4 Jun 2011 19:10:20 +0000 (20:10 +0100)
Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/mathops.h

index 98c9acf..ec76eaa 100644 (file)
 
 /* generic implementation */
 
+#ifndef MUL64
+#   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
+#endif
+
 #ifndef MULL
-#   define MULL(a,b,s) (((int64_t)(a) * (int64_t)(b)) >> (s))
+#   define MULL(a,b,s) (MUL64(a, b) >> (s))
 #endif
 
 #ifndef MULH
 static av_always_inline int MULH(int a, int b){
-    return ((int64_t)(a) * (int64_t)(b))>>32;
+    return MUL64(a, b) >> 32;
 }
 #endif
 
@@ -57,10 +61,6 @@ static av_always_inline unsigned UMULH(unsigned a, unsigned b){
 }
 #endif
 
-#ifndef MUL64
-#   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
-#endif
-
 #ifndef MAC64
 #   define MAC64(d, a, b) ((d) += MUL64(a, b))
 #endif