From c1706980c01353072e760c843846d12ea68ca8b1 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 27 Sep 2018 13:11:48 +0300 Subject: Remove dead code (only IS_ARRAY may relive zendi_convert_scalar_to_number()), and micro-optimization. --- Zend/zend_operators.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'Zend') diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 2081338a01..71663ae31c 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; } } -- cgit v1.2.1