On Tue, Jan 12, 2010 at 10:32:23AM -0500, A. Craig West wrote:
> I recently ran into a problem building ffmpeg on a uclibc system,
> where ffmpeg appears to depend on the log2f function. A bit of
> investigation led me to a section of code in libm/float_wrappers.c,
> with #undef L_log2f, and the comment:
>  /* For the time being, do _NOT_ implement these functions
>  * that are defined by SuSv3 */
> 
> What is missing is any explanation of WHY these functions are left
> unimplemented.

Attached patch enable those function to allow ffmpeg/x264/... to build.

> There is the secondary issue of why ffmpeg requires
> this function, but that isn't really pertinent to this list...

Significant overall speed difference compared to the double version
(on libc which actually implement a float version).

Aurel
>From af843d0a18279725cedb51e00209457e8d0281c0 Mon Sep 17 00:00:00 2001
From: Aurelien Jacobs <au...@gnuage.org>
Date: Fri, 15 Jan 2010 19:43:06 +0100
Subject: [PATCH] enable log2f and exp2f

Signed-off-by: Aurelien Jacobs <au...@gnuage.org>
---
 libm/Makefile.in         |    4 +++-
 libm/float_wrappers.c    |    4 ++--
 test/math/compile_test.c |    4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libm/Makefile.in b/libm/Makefile.in
index 56b2d76..6eb9358 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -75,7 +75,7 @@ libm_CSRC := \
 	s_remquo.c w_exp2.c
 
 # Not implemented [yet?], see comment in float_wrappers.c:
-# exp2f.o fdimf.o fmaf.o fmaxf.o fminf.o log2f.o
+# fdimf.o fmaf.o fmaxf.o fminf.o
 # nearbyintf.o remquof.o scalblnf.o tgammaf.o
 FL_MOBJ := \
 	acosf.o \
@@ -93,6 +93,7 @@ FL_MOBJ := \
 	coshf.o \
 	erfcf.o \
 	erff.o \
+	exp2f.o \
 	expf.o \
 	expm1f.o \
 	fabsf.o \
@@ -108,6 +109,7 @@ FL_MOBJ := \
 	llroundf.o \
 	log10f.o \
 	log1pf.o \
+	log2f.o \
 	logbf.o \
 	logf.o \
 	lrintf.o \
diff --git a/libm/float_wrappers.c b/libm/float_wrappers.c
index 93d56c3..e1ab8b5 100644
--- a/libm/float_wrappers.c
+++ b/libm/float_wrappers.c
@@ -41,12 +41,10 @@ long long func##f (float x) \
 
 /* For the time being, do _NOT_ implement these functions
  * that are defined by SuSv3 [why?] */
-#undef L_exp2f         /*float       exp2f(float);*/
 #undef L_fdimf         /*float       fdimf(float, float);*/
 #undef L_fmaf          /*float       fmaf(float, float, float);*/
 #undef L_fmaxf         /*float       fmaxf(float, float);*/
 #undef L_fminf         /*float       fminf(float, float);*/
-#undef L_log2f         /*float       log2f(float);*/
 #undef L_nearbyintf    /*float       nearbyintf(float);*/
 #undef L_nexttowardf   /*float       nexttowardf(float, long double);*/
 #undef L_remquof       /*float       remquof(float, float, int *);*/
@@ -70,6 +68,7 @@ float       cosf(float);
 float       coshf(float);
 float       erfcf(float);
 float       erff(float);
+float       exp2f(float);
 float       expf(float);
 float       expm1f(float);
 float       fabsf(float);
@@ -83,6 +82,7 @@ float       lgammaf(float);
 long long   llroundf(float);
 float       log10f(float);
 float       log1pf(float);
+float       log2f(float);
 float       logbf(float);
 float       logf(float);
 long        lroundf(float);
diff --git a/test/math/compile_test.c b/test/math/compile_test.c
index 6148885..ab8c40c 100644
--- a/test/math/compile_test.c
+++ b/test/math/compile_test.c
@@ -18,7 +18,7 @@ r += cosf(float_x);
 r += coshf(float_x);
 r += erfcf(float_x);
 r += erff(float_x);
-/*r += exp2f(float_x); - uclibc does not have it (yet?) */
+r += exp2f(float_x);
 r += expf(float_x);
 r += expm1f(float_x);
 r += fabsf(float_x);
@@ -38,7 +38,7 @@ r += llrintf(float_x);
 r += llroundf(float_x);
 r += log10f(float_x);
 r += log1pf(float_x);
-/*r += log2f(float_x); - uclibc does not have it (yet?) */
+r += log2f(float_x);
 r += logbf(float_x);
 r += logf(float_x);
 r += lrintf(float_x);
-- 
1.6.0.4

_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to