Browse code

Add replacements for log2f(), exp2() and exp2f() for platforms that lacks it.

Should fix build breakage on some platforms introduced in r21125.

Originally committed as revision 21155 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak authored on 2010/01/12 11:19:51
Showing 2 changed files
... ...
@@ -954,6 +954,8 @@ HAVE_LIST="
954 954
     dos_paths
955 955
     ebp_available
956 956
     ebx_available
957
+    exp2
958
+    exp2f
957 959
     fast_64bit
958 960
     fast_cmov
959 961
     fast_unaligned
... ...
@@ -970,6 +972,7 @@ HAVE_LIST="
970 970
     libdc1394_2
971 971
     llrint
972 972
     log2
973
+    log2f
973 974
     loongson
974 975
     lrint
975 976
     lrintf
... ...
@@ -2379,8 +2382,11 @@ done
2379 2379
 check_lib math.h sin -lm
2380 2380
 check_lib va/va.h vaInitialize -lva
2381 2381
 
2382
+check_func exp2
2383
+check_func exp2f
2382 2384
 check_func llrint
2383 2385
 check_func log2
2386
+check_func log2f
2384 2387
 check_func lrint
2385 2388
 check_func lrintf
2386 2389
 check_func round
... ...
@@ -263,6 +263,20 @@ if ((y) < (x)) {\
263 263
     }\
264 264
 }
265 265
 
266
+#if !HAVE_EXP2
267
+static av_always_inline av_const double exp2(double x)
268
+{
269
+    return exp(x * 0.693147180559945);
270
+}
271
+#endif /* HAVE_EXP2 */
272
+
273
+#if !HAVE_EXP2F
274
+static av_always_inline av_const float exp2f(float x)
275
+{
276
+    return exp2(x);
277
+}
278
+#endif /* HAVE_EXP2F */
279
+
266 280
 #if !HAVE_LLRINT
267 281
 static av_always_inline av_const long long llrint(double x)
268 282
 {
... ...
@@ -277,6 +291,13 @@ static av_always_inline av_const double log2(double x)
277 277
 }
278 278
 #endif /* HAVE_LOG2 */
279 279
 
280
+#if !HAVE_LOG2F
281
+static av_always_inline av_const float log2f(float x)
282
+{
283
+    return log2(x);
284
+}
285
+#endif /* HAVE_LOG2F */
286
+
280 287
 #if !HAVE_LRINT
281 288
 static av_always_inline av_const long int lrint(double x)
282 289
 {