com php-src: Remove custom implementation for inifinity and NAN as we can now rely on C99: Zend/zend_portability.h
| From: | George Peter Banyard | Date: | Wed, 04 Dec 2019 12:17:20 +0000 |
| Subject: | com php-src: Remove custom implementation for inifinity and NAN as we can now rely on C99: Zend/zend_portability.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109380@lists.php.net to get a copy of this message | ||
Commit: 67f85573c5bd5fcfede398bf5e871862842f889d
Author: George Peter Banyard <girgias@php.net> Wed, 4 Dec 2019 13:13:06 +0100
Parents: 2d0b0d6448d590c708c449cd0862744007e6f22f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=67f85573c5bd5fcfede398bf5e871862842f889d
Log:
Remove custom implementation for inifinity and NAN as we can now rely on C99
Those ZEND_* constant variant are now identical to their C counterpart, we may considering removing
them in the future.
Changed paths:
M Zend/zend_portability.h
Diff:
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index dd518aebbb3..546a66b9f56 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -438,49 +438,9 @@ char *alloca();
#define ZEND_BIT_TEST(bits, bit) \
(((bits)[(bit) / (sizeof((bits)[0])*8)] >> ((bit) & (sizeof((bits)[0])*8-1))) & 1)
-/* We always define a function, even if there's a macro or expression we could
- * alias, so that using it in contexts where we can't make function calls
- * won't fail to compile on some machines and not others.
- */
-static zend_always_inline double _zend_get_inf(void) /* {{{ */
-{
-#ifdef INFINITY
- return INFINITY;
-#elif HAVE_HUGE_VAL_INF
- return HUGE_VAL;
-#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
-# define _zend_DOUBLE_INFINITY_HIGH 0x7ff00000
- double val = 0.0;
- ((uint32_t*)&val)[1] = _zend_DOUBLE_INFINITY_HIGH;
- ((uint32_t*)&val)[0] = 0;
- return val;
-#elif HAVE_ATOF_ACCEPTS_INF
- return atof("INF");
-#else
- return 1.0/0.0;
-#endif
-} /* }}} */
-#define ZEND_INFINITY (_zend_get_inf())
-
-static zend_always_inline double _zend_get_nan(void) /* {{{ */
-{
-#ifdef NAN
- return NAN;
-#elif HAVE_HUGE_VAL_NAN
- return HUGE_VAL + -HUGE_VAL;
-#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
-# define _zend_DOUBLE_QUIET_NAN_HIGH 0xfff80000
- double val = 0.0;
- ((uint32_t*)&val)[1] = _zend_DOUBLE_QUIET_NAN_HIGH;
- ((uint32_t*)&val)[0] = 0;
- return val;
-#elif HAVE_ATOF_ACCEPTS_NAN
- return atof("NAN");
-#else
- return 0.0/0.0;
-#endif
-} /* }}} */
-#define ZEND_NAN (_zend_get_nan())
+#define ZEND_INFINITY INFINITY
+
+#define ZEND_NAN NAN
#define ZEND_STRL(str) (str), (sizeof(str)-1)
#define ZEND_STRS(str) (str), (sizeof(str))