diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-02-26 01:28:47 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-02-26 01:28:47 +0300 |
commit | 716da71446ebbd40fa6cf2cea8a4b70f504cc3cd (patch) | |
tree | fe187593d7cf361557c2cfd9d626bbe925b7d8c5 /Zend/zend_operators.h | |
parent | 803e1432c819a1c8fda2594d1d3f7ba3fa265d19 (diff) | |
download | php-git-716da71446ebbd40fa6cf2cea8a4b70f504cc3cd.tar.gz |
Don't inline slow path
Diffstat (limited to 'Zend/zend_operators.h')
-rw-r--r-- | Zend/zend_operators.h | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index d66f82d364..31d84fc5b1 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -108,41 +108,15 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) return 0; } } -#elif SIZEOF_ZEND_LONG == 4 -static zend_always_inline zend_long zend_dval_to_lval(double d) -{ - if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) { - return 0; - } else if (!ZEND_DOUBLE_FITS_LONG(d)) { - double two_pow_32 = pow(2., 32.), - dmod; - - dmod = fmod(d, two_pow_32); - if (dmod < 0) { - /* we're going to make this number positive; call ceil() - * to simulate rounding towards 0 of the negative number */ - dmod = ceil(dmod) + two_pow_32; - } - return (zend_long)(zend_ulong)dmod; - } - return (zend_long)d; -} #else +ZEND_API zend_long zend_dval_to_lval_slow(double d); + static zend_always_inline zend_long zend_dval_to_lval(double d) { if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) { return 0; } else if (!ZEND_DOUBLE_FITS_LONG(d)) { - double two_pow_64 = pow(2., 64.), - dmod; - - dmod = fmod(d, two_pow_64); - if (dmod < 0) { - /* no need to call ceil; original double must have had no - * fractional part, hence dmod does not have one either */ - dmod += two_pow_64; - } - return (zend_long)(zend_ulong)dmod; + return zend_dval_to_lval_slow(d); } return (zend_long)d; } |