summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2006-05-25 15:53:30 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2006-05-25 15:53:30 (GMT)
commitf94323fbb4e83b756b1f328f06a1615d8c366c20 (patch)
tree0162fcea03d1e3ba5aeec93b1cff612dd19c01d7 /Include
parent4b4e33ef14cecd0bc9c6566ea8b402733e7e445f (diff)
downloadcpython-f94323fbb4e83b756b1f328f06a1615d8c366c20.zip
cpython-f94323fbb4e83b756b1f328f06a1615d8c366c20.tar.gz
cpython-f94323fbb4e83b756b1f328f06a1615d8c366c20.tar.bz2
Added a new macro, Py_IS_FINITE(X). On windows there is an intrinsic for this and it is more efficient than to use !Py_IS_INFINITE(X) && !Py_IS_NAN(X). No change on other platforms
Diffstat (limited to 'Include')
-rw-r--r--Include/pyport.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index df44be6..66726e8 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -295,6 +295,15 @@ extern "C" {
#define Py_IS_INFINITY(X) ((X) && (X)*0.5 == (X))
#endif
+/* Py_IS_INFINITY(X)
+ * Return 1 if float or double arg is an infinity, else 0.
+ * This some archicetcures (windows) have intrisics for this, so a special
+ * macro for this particular test is useful
+ */
+#ifndef Py_IS_FINITE
+#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
+#endif
+
/* HUGE_VAL is supposed to expand to a positive double infinity. Python
* uses Py_HUGE_VAL instead because some platforms are broken in this
* respect. We used to embed code in pyport.h to try to worm around that,