From 9560b6b152efeb23cc4e570dbaea5ef333ac971f Mon Sep 17 00:00:00 2001 From: nsz Date: Tue, 13 Mar 2012 19:51:14 +0100 Subject: [PATCH] remove libm.h includes when math.h and float.h are enough --- src/math/fdim.c | 2 +- src/math/fdimf.c | 2 +- src/math/fdiml.c | 3 ++- src/math/fmax.c | 2 +- src/math/fmaxf.c | 2 +- src/math/fmaxl.c | 3 ++- src/math/fmin.c | 2 +- src/math/fminf.c | 2 +- src/math/fminl.c | 3 ++- src/math/ilogb.c | 1 - src/math/ldexp.c | 2 +- src/math/ldexpf.c | 2 +- src/math/ldexpl.c | 2 +- src/math/llrintl.c | 4 +++- src/math/llroundl.c | 4 +++- src/math/lrintl.c | 4 +++- src/math/lroundl.c | 4 +++- src/math/nearbyint.c | 2 +- src/math/nearbyintf.c | 2 +- src/math/nearbyintl.c | 4 +++- src/math/nexttoward.c | 1 + src/math/nexttowardl.c | 2 +- src/math/remainderl.c | 3 ++- src/math/round.c | 2 +- src/math/roundf.c | 2 +- src/math/roundl.c | 4 +++- src/math/scalb.c | 2 +- src/math/scalbf.c | 2 +- src/math/scalbln.c | 2 +- src/math/scalblnf.c | 2 +- src/math/scalblnl.c | 3 ++- 31 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/math/fdim.c b/src/math/fdim.c index fb25521c..95854606 100644 --- a/src/math/fdim.c +++ b/src/math/fdim.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include double fdim(double x, double y) { diff --git a/src/math/fdimf.c b/src/math/fdimf.c index 5cfeac6b..543c3648 100644 --- a/src/math/fdimf.c +++ b/src/math/fdimf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include float fdimf(float x, float y) { diff --git a/src/math/fdiml.c b/src/math/fdiml.c index cda3022e..62e29b7d 100644 --- a/src/math/fdiml.c +++ b/src/math/fdiml.c @@ -1,4 +1,5 @@ -#include "libm.h" +#include +#include #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double fdiml(long double x, long double y) diff --git a/src/math/fmax.c b/src/math/fmax.c index 0b6bf6f3..94f0caa1 100644 --- a/src/math/fmax.c +++ b/src/math/fmax.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include double fmax(double x, double y) { diff --git a/src/math/fmaxf.c b/src/math/fmaxf.c index 7767c303..695d8179 100644 --- a/src/math/fmaxf.c +++ b/src/math/fmaxf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include float fmaxf(float x, float y) { diff --git a/src/math/fmaxl.c b/src/math/fmaxl.c index 8a1e3652..4b03158e 100644 --- a/src/math/fmaxl.c +++ b/src/math/fmaxl.c @@ -1,4 +1,5 @@ -#include "libm.h" +#include +#include #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double fmaxl(long double x, long double y) diff --git a/src/math/fmin.c b/src/math/fmin.c index d1f16454..08a8fd17 100644 --- a/src/math/fmin.c +++ b/src/math/fmin.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include double fmin(double x, double y) { diff --git a/src/math/fminf.c b/src/math/fminf.c index 0964cdb3..3573c7de 100644 --- a/src/math/fminf.c +++ b/src/math/fminf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include float fminf(float x, float y) { diff --git a/src/math/fminl.c b/src/math/fminl.c index ae7159a5..69bc24a7 100644 --- a/src/math/fminl.c +++ b/src/math/fminl.c @@ -1,4 +1,5 @@ -#include "libm.h" +#include +#include #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double fminl(long double x, long double y) diff --git a/src/math/ilogb.c b/src/math/ilogb.c index c5915a0c..0a3a6a46 100644 --- a/src/math/ilogb.c +++ b/src/math/ilogb.c @@ -11,7 +11,6 @@ int ilogb(double x) if (u.bits == 0) return FP_ILOGB0; /* subnormal x */ - // FIXME: scale up subnormals with a *0x1p53 or find top set bit with a better method for (e = -0x3ff; u.bits < (uint64_t)1<<63; e--, u.bits<<=1); return e; } diff --git a/src/math/ldexp.c b/src/math/ldexp.c index 36835dba..f4d1cd6a 100644 --- a/src/math/ldexp.c +++ b/src/math/ldexp.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include double ldexp(double x, int n) { diff --git a/src/math/ldexpf.c b/src/math/ldexpf.c index f0981ae4..3bad5f39 100644 --- a/src/math/ldexpf.c +++ b/src/math/ldexpf.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include float ldexpf(float x, int n) { diff --git a/src/math/ldexpl.c b/src/math/ldexpl.c index 885ff6e9..fd145ccc 100644 --- a/src/math/ldexpl.c +++ b/src/math/ldexpl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include long double ldexpl(long double x, int n) { diff --git a/src/math/llrintl.c b/src/math/llrintl.c index 6b0838d4..ec2cf86b 100644 --- a/src/math/llrintl.c +++ b/src/math/llrintl.c @@ -1,4 +1,6 @@ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long long llrintl(long double x) { diff --git a/src/math/llroundl.c b/src/math/llroundl.c index 9e2cfdc7..107744a9 100644 --- a/src/math/llroundl.c +++ b/src/math/llroundl.c @@ -1,4 +1,6 @@ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long long llroundl(long double x) { diff --git a/src/math/lrintl.c b/src/math/lrintl.c index 7c09653e..c076326f 100644 --- a/src/math/lrintl.c +++ b/src/math/lrintl.c @@ -1,4 +1,6 @@ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long lrintl(long double x) { diff --git a/src/math/lroundl.c b/src/math/lroundl.c index 1469127b..7b593f77 100644 --- a/src/math/lroundl.c +++ b/src/math/lroundl.c @@ -1,4 +1,6 @@ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long lroundl(long double x) { diff --git a/src/math/nearbyint.c b/src/math/nearbyint.c index 781769fb..714c55ca 100644 --- a/src/math/nearbyint.c +++ b/src/math/nearbyint.c @@ -1,5 +1,5 @@ #include -#include "libm.h" +#include /* rint may raise inexact (and it should not alter the fenv otherwise) diff --git a/src/math/nearbyintf.c b/src/math/nearbyintf.c index e4bdb26c..07df8f54 100644 --- a/src/math/nearbyintf.c +++ b/src/math/nearbyintf.c @@ -1,5 +1,5 @@ #include -#include "libm.h" +#include float nearbyintf(float x) { fenv_t e; diff --git a/src/math/nearbyintl.c b/src/math/nearbyintl.c index b58527c8..2906f383 100644 --- a/src/math/nearbyintl.c +++ b/src/math/nearbyintl.c @@ -1,4 +1,6 @@ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double nearbyintl(long double x) { diff --git a/src/math/nexttoward.c b/src/math/nexttoward.c index 5e12c48b..e150eaad 100644 --- a/src/math/nexttoward.c +++ b/src/math/nexttoward.c @@ -11,6 +11,7 @@ */ #include "libm.h" + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 double nexttoward(double x, long double y) { diff --git a/src/math/nexttowardl.c b/src/math/nexttowardl.c index c393ce97..67a63403 100644 --- a/src/math/nexttowardl.c +++ b/src/math/nexttowardl.c @@ -1,4 +1,4 @@ -#include "libm.h" +#include long double nexttowardl(long double x, long double y) { diff --git a/src/math/remainderl.c b/src/math/remainderl.c index b99f9381..2a13c1d5 100644 --- a/src/math/remainderl.c +++ b/src/math/remainderl.c @@ -1,4 +1,5 @@ -#include "libm.h" +#include +#include #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double remainderl(long double x, long double y) diff --git a/src/math/round.c b/src/math/round.c index 21373847..bf0b453f 100644 --- a/src/math/round.c +++ b/src/math/round.c @@ -25,7 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libm.h" +#include double round(double x) { diff --git a/src/math/roundf.c b/src/math/roundf.c index 3cfd8ae5..662a454b 100644 --- a/src/math/roundf.c +++ b/src/math/roundf.c @@ -25,7 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libm.h" +#include float roundf(float x) { diff --git a/src/math/roundl.c b/src/math/roundl.c index ce56e8a9..99146f07 100644 --- a/src/math/roundl.c +++ b/src/math/roundl.c @@ -25,7 +25,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double roundl(long double x) { diff --git a/src/math/scalb.c b/src/math/scalb.c index 7706e9cb..a54bdf2b 100644 --- a/src/math/scalb.c +++ b/src/math/scalb.c @@ -15,7 +15,7 @@ * should use scalbn() instead. */ -#include "libm.h" +#include double scalb(double x, double fn) { diff --git a/src/math/scalbf.c b/src/math/scalbf.c index 0cc091f1..d08f2a1a 100644 --- a/src/math/scalbf.c +++ b/src/math/scalbf.c @@ -13,7 +13,7 @@ * ==================================================== */ -#include "libm.h" +#include float scalbf(float x, float fn) { diff --git a/src/math/scalbln.c b/src/math/scalbln.c index 53854fda..e6f3f195 100644 --- a/src/math/scalbln.c +++ b/src/math/scalbln.c @@ -1,5 +1,5 @@ #include -#include "libm.h" +#include double scalbln(double x, long n) { diff --git a/src/math/scalblnf.c b/src/math/scalblnf.c index 61600f18..d8e8166b 100644 --- a/src/math/scalblnf.c +++ b/src/math/scalblnf.c @@ -1,5 +1,5 @@ #include -#include "libm.h" +#include float scalblnf(float x, long n) { diff --git a/src/math/scalblnl.c b/src/math/scalblnl.c index 82ebbed0..854c51c4 100644 --- a/src/math/scalblnl.c +++ b/src/math/scalblnl.c @@ -1,5 +1,6 @@ #include -#include "libm.h" +#include +#include #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double scalblnl(long double x, long n) -- 2.25.1