diff options
Diffstat (limited to 'Zend/zend_operators.h')
-rw-r--r-- | Zend/zend_operators.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 1426fe919a..20f8ccd32c 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -913,6 +913,36 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2) return Z_LVAL(result) == 0; } +static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2) +{ + zval result; + if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { + return Z_LVAL_P(op1) == Z_LVAL_P(op2); + } + compare_function(&result, op1, op2); + return Z_LVAL(result) == 0; +} + +static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2) +{ + zval result; + if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { + if (Z_STR_P(op1) == Z_STR_P(op2)) { + return 1; + } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') { + if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) { + return 0; + } else { + return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0; + } + } else { + return zendi_smart_strcmp(op1, op2) == 0; + } + } + compare_function(&result, op1, op2); + return Z_LVAL(result) == 0; +} + static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval *op2) { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { |