com php-src: Remove dead code (only IS_ARRAY may relive zendi_convert_scalar_to_number()), and m icro-optimization.: Zend/zend_operators.c

From: Date: Thu, 27 Sep 2018 10:11:48 +0000
Subject: com php-src: Remove dead code (only IS_ARRAY may relive zendi_convert_scalar_to_number()), and m icro-optimization.: Zend/zend_operators.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-103294@lists.php.net to get a copy of this message
Commit: c1706980c01353072e760c843846d12ea68ca8b1 Author: Dmitry Stogov <dmitry@zend.com> Thu, 27 Sep 2018 13:11:48 +0300 Parents: 390b74ee34ac567cab7d6b07b130a16504bbc43c Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c1706980c01353072e760c843846d12ea68ca8b1 Log: Remove dead code (only IS_ARRAY may relive zendi_convert_scalar_to_number()), and micro-optimization. Changed paths: M Zend/zend_operators.c Diff: diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 2081338..71663ae 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2129,15 +2129,15 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) } } if (!converted) { - if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) { + if (Z_TYPE_P(op1) < IS_TRUE) { ZVAL_LONG(result, zval_is_true(op2) ? -1 : 0); return SUCCESS; - } else if (Z_TYPE_P(op2) == IS_NULL || Z_TYPE_P(op2) == IS_FALSE) { - ZVAL_LONG(result, zval_is_true(op1) ? 1 : 0); - return SUCCESS; } else if (Z_TYPE_P(op1) == IS_TRUE) { ZVAL_LONG(result, zval_is_true(op2) ? 0 : 1); return SUCCESS; + } else if (Z_TYPE_P(op2) < IS_TRUE) { + ZVAL_LONG(result, zval_is_true(op1) ? 1 : 0); + return SUCCESS; } else if (Z_TYPE_P(op2) == IS_TRUE) { ZVAL_LONG(result, zval_is_true(op1) ? 0 : -1); return SUCCESS; @@ -2158,14 +2158,12 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) } else if (Z_TYPE_P(op2)==IS_ARRAY) { ZVAL_LONG(result, -1); return SUCCESS; - } else if (Z_TYPE_P(op1)==IS_OBJECT) { - ZVAL_LONG(result, 1); - return SUCCESS; - } else if (Z_TYPE_P(op2)==IS_OBJECT) { - ZVAL_LONG(result, -1); - return SUCCESS; } else { - ZVAL_LONG(result, 0); + ZEND_ASSERT(0); + zend_throw_error(NULL, "Unsupported operand types"); + if (result != op1) { + ZVAL_UNDEF(result); + } return FAILURE; } }

« previous php.cvs (#103294) next »