about summary refs log tree commit diff
path: root/math/w_hypot.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
commit0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch)
treef9d26c8abc0de39d18d4c13e70f6022cdc6b461f /math/w_hypot.c
parenta843a204a3e8a0dd53584dad3668771abaec84ac (diff)
downloadglibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.gz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.xz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.zip
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option
and lots of the wrapper functions have been optimized.
Diffstat (limited to 'math/w_hypot.c')
-rw-r--r--math/w_hypot.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/math/w_hypot.c b/math/w_hypot.c
index df69ed383b..2c6de28600 100644
--- a/math/w_hypot.c
+++ b/math/w_hypot.c
@@ -10,10 +10,6 @@
  * ====================================================
  */
 
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
-#endif
-
 /*
  * wrapper hypot(x,y)
  */
@@ -22,24 +18,15 @@ static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
 #include <math_private.h>
 
 
-#ifdef __STDC__
-	double __hypot(double x, double y)/* wrapper hypot */
-#else
-	double __hypot(x,y)		/* wrapper hypot */
-	double x,y;
-#endif
+double
+__hypot (double x, double y)
 {
-#ifdef _IEEE_LIBM
-	return __ieee754_hypot(x,y);
-#else
-	double z;
-	z = __ieee754_hypot(x,y);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if((!__finite(z))&&__finite(x)&&__finite(y))
-	    return __kernel_standard(x,y,4); /* hypot overflow */
-	else
-	    return z;
-#endif
+	double z = __ieee754_hypot(x,y);
+	if(__builtin_expect(!__finite(z), 0)
+	   && __finite(x) && __finite(y) && _LIB_VERSION != _IEEE_)
+	    return __kernel_standard(x, y, 4); /* hypot overflow */
+
+	return z;
 }
 weak_alias (__hypot, hypot)
 #ifdef NO_LONG_DOUBLE