diff intmath.h @ 816:d87093e4b925 libavutil

Move FASTDIV macro to intmath.h
author mru
date Tue, 19 Jan 2010 23:25:36 +0000
parents 36cc11e07d9b
children 41db9ae634fe
line wrap: on
line diff
--- a/intmath.h	Tue Jan 19 04:40:18 2010 +0000
+++ b/intmath.h	Tue Jan 19 23:25:36 2010 +0000
@@ -24,6 +24,14 @@
 #include "config.h"
 #include "common.h"
 
+extern const uint32_t ff_inverse[257];
+
+#if   ARCH_ARM
+#   include "arm/intmath.h"
+#elif ARCH_X86
+#   include "x86/intmath.h"
+#endif
+
 #if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)
 
 #ifndef av_log2
@@ -38,4 +46,14 @@
 
 #endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
 
+#ifndef FASTDIV
+
+#if CONFIG_FASTDIV
+#    define FASTDIV(a,b)   ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
+#else
+#    define FASTDIV(a,b)   ((a) / (b))
+#endif
+
+#endif /* FASTDIV */
+
 #endif /* AVUTIL_INTMATH_H */