# HG changeset patch # User Bruno Haible # Date 1318282554 -7200 # Node ID f964f4ef47e5db3e298e8e1220c16357ae13a289 # Parent 7107ea7879b2300cce9e1cd69f2a0ff491a34674 ldexpl: Simplify for platforms where 'long double' == 'double'. * lib/ldexpl.c (ldexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. * m4/ldexpl.m4 (gl_FUNC_LDEXPL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine LDEXPL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/ldexpl (Depends-on): Add ldexp. Update conditions. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-10-10 Bruno Haible + + ldexpl: Simplify for platforms where 'long double' == 'double'. + * lib/ldexpl.c (ldexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New + alternative implementation. + * m4/ldexpl.m4 (gl_FUNC_LDEXPL): Require gl_LONG_DOUBLE_VS_DOUBLE. + Determine LDEXPL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. + * modules/ldexpl (Depends-on): Add ldexp. Update conditions. + 2011-10-10 Tom G. Christensen (tiny change) ffsll: set correct witness diff --git a/lib/ldexpl.c b/lib/ldexpl.c --- a/lib/ldexpl.c +++ b/lib/ldexpl.c @@ -23,8 +23,18 @@ /* Specification. */ #include -#include -#include "fpucw.h" +#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE + +long double +ldexpl (long double x, int exp) +{ + return ldexp (x, exp); +} + +#else + +# include +# include "fpucw.h" long double ldexpl (long double x, int exp) @@ -65,6 +75,8 @@ return x; } +#endif + #if 0 int main (void) diff --git a/m4/ldexpl.m4 b/m4/ldexpl.m4 --- a/m4/ldexpl.m4 +++ b/m4/ldexpl.m4 @@ -1,4 +1,4 @@ -# ldexpl.m4 serial 13 +# ldexpl.m4 serial 14 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,6 +7,7 @@ AC_DEFUN([gl_FUNC_LDEXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) AC_REQUIRE([gl_FUNC_ISNANL]) dnl for ISNANL_LIBM dnl Check whether it's declared. dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in . @@ -53,7 +54,12 @@ fi if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then dnl Find libraries needed to link lib/ldexpl.c. - LDEXPL_LIBM="$ISNANL_LIBM" + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + AC_REQUIRE([gl_FUNC_LDEXP]) + LDEXPL_LIBM="$LDEXP_LIBM" + else + LDEXPL_LIBM="$ISNANL_LIBM" + fi fi AC_SUBST([LDEXPL_LIBM]) ]) diff --git a/modules/ldexpl b/modules/ldexpl --- a/modules/ldexpl +++ b/modules/ldexpl @@ -7,8 +7,9 @@ Depends-on: math -isnanl [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no] -fpucw [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no] +ldexp [{ test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1] +isnanl [{ test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] +fpucw [{ test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] configure.ac: gl_FUNC_LDEXPL