about summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-08 10:18:26 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-08 10:18:26 -0400
commit7edb55ce06ab1fa716a062cd1cb6682585bb449d (patch)
tree3fed82e7c3f86ac57f3e9d6f314044b7dbdb8d03 /sysdeps/ieee754/flt-32
parent187da0aedcd9d0a2fb34477bef41549681ba1273 (diff)
downloadglibc-7edb55ce06ab1fa716a062cd1cb6682585bb449d.tar.gz
glibc-7edb55ce06ab1fa716a062cd1cb6682585bb449d.tar.xz
glibc-7edb55ce06ab1fa716a062cd1cb6682585bb449d.zip
Optimize use of isnan, isinf, finite
Diffstat (limited to 'sysdeps/ieee754/flt-32')
-rw-r--r--sysdeps/ieee754/flt-32/s_finitef.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_isinf_nsf.c20
-rw-r--r--sysdeps/ieee754/flt-32/s_isnanf.c3
3 files changed, 23 insertions, 1 deletions
diff --git a/sysdeps/ieee754/flt-32/s_finitef.c b/sysdeps/ieee754/flt-32/s_finitef.c
index 65767f8f93..2df513be75 100644
--- a/sysdeps/ieee754/flt-32/s_finitef.c
+++ b/sysdeps/ieee754/flt-32/s_finitef.c
@@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: s_finitef.c,v 1.4 1995/05/10 20:47:18 jtc Exp $"
 #include "math.h"
 #include "math_private.h"
 
+#undef __finitef
 #ifdef __STDC__
 	int __finitef(float x)
 #else
diff --git a/sysdeps/ieee754/flt-32/s_isinf_nsf.c b/sysdeps/ieee754/flt-32/s_isinf_nsf.c
new file mode 100644
index 0000000000..bc37785168
--- /dev/null
+++ b/sysdeps/ieee754/flt-32/s_isinf_nsf.c
@@ -0,0 +1,20 @@
+/*
+ * Written by Ulrich Drepper <drepper@gmail.com>.
+ */
+
+/*
+ * __isinf_nsf(x) returns != 0 if x is ±inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#undef __isinf_nsf
+int
+__isinf_nsf (float x)
+{
+	int32_t ix,t;
+	GET_FLOAT_WORD(ix,x);
+	return (ix & 0x7fffffff) == 0x7f800000;
+}
diff --git a/sysdeps/ieee754/flt-32/s_isnanf.c b/sysdeps/ieee754/flt-32/s_isnanf.c
index 4ac16c2b5f..1b1b2475b9 100644
--- a/sysdeps/ieee754/flt-32/s_isnanf.c
+++ b/sysdeps/ieee754/flt-32/s_isnanf.c
@@ -4,7 +4,7 @@
 
 /*
  * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright (C) 1993, 2011 by Sun Microsystems, Inc. All rights reserved.
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
@@ -25,6 +25,7 @@ static char rcsid[] = "$NetBSD: s_isnanf.c,v 1.4 1995/05/10 20:47:38 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
+#undef __isnanf
 #ifdef __STDC__
 	int __isnanf(float x)
 #else