diff common.h @ 870:3790c30fc3ad libavutil

Fix build on configurations without fast av_log2() This is a bit hackish. I will try to think of something nicer, but this will do for now.
author mru
date Tue, 09 Mar 2010 01:19:28 +0000
parents f4b99cb386ad
children 0795a743bda1
line wrap: on
line diff
--- a/common.h	Mon Mar 08 22:16:05 2010 +0000
+++ b/common.h	Tue Mar 09 01:19:28 2010 +0000
@@ -36,11 +36,6 @@
 #include <string.h>
 #include "attributes.h"
 
-#ifdef HAVE_AV_CONFIG_H
-#   include "config.h"
-#   include "intmath.h"
-#endif
-
 //rounded division & shift
 #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
 /* assume b>0 */
@@ -62,8 +57,7 @@
 
 extern const uint8_t av_reverse[256];
 
-#ifndef av_log2
-static inline av_const int av_log2(unsigned int v)
+static inline av_const int av_log2_c(unsigned int v)
 {
     int n = 0;
     if (v & 0xffff0000) {
@@ -78,10 +72,8 @@
 
     return n;
 }
-#endif
 
-#ifndef av_log2_16bit
-static inline av_const int av_log2_16bit(unsigned int v)
+static inline av_const int av_log2_16bit_c(unsigned int v)
 {
     int n = 0;
     if (v & 0xff00) {
@@ -92,6 +84,17 @@
 
     return n;
 }
+
+#ifdef HAVE_AV_CONFIG_H
+#   include "config.h"
+#   include "intmath.h"
+#endif
+
+#ifndef av_log2
+#   define av_log2       av_log2_c
+#endif
+#ifndef av_log2_16bit
+#   define av_log2_16bit av_log2_16bit_c
 #endif
 
 /**