Lines Matching refs:op1
407 if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
408 && UNEXPECTED(Z_OBJ_HANDLER_P(op1, do_operation))) { \
409 if (EXPECTED(SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, op2))) { \
417 && EXPECTED(SUCCESS == Z_OBJ_HANDLER_P(op2, do_operation)(opcode, result, op1, op2))) { \
427 if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
428 && UNEXPECTED(Z_OBJ_HANDLER_P(op1, do_operation)) \
429 && EXPECTED(SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, NULL))) { \
433 #define convert_op1_op2_long(op1, op1_lval, op2, op2_lval, result, opcode, sigil) \ argument
435 if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) { \
437 if (Z_ISREF_P(op1)) { \
438 op1 = Z_REFVAL_P(op1); \
439 if (Z_TYPE_P(op1) == IS_LONG) { \
440 op1_lval = Z_LVAL_P(op1); \
445 op1_lval = zendi_try_get_long(op1, &failed); \
447 zend_binop_error(sigil, op1, op2); \
448 if (result != op1) { \
454 op1_lval = Z_LVAL_P(op1); \
470 zend_binop_error(sigil, op1, op2); \
471 if (result != op1) { \
1006 …ver_inline void ZEND_FASTCALL zend_binop_error(const char *operator, zval *op1, zval *op2) /* {{{ … in zend_binop_error() argument
1012 zend_zval_type_name(op1), operator, zend_zval_type_name(op2)); in zend_binop_error()
1016 static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zval *op1, zval *op2) … in add_function_array() argument
1018 if (result == op1 && Z_ARR_P(op1) == Z_ARR_P(op2)) { in add_function_array()
1022 if (result != op1) { in add_function_array()
1023 ZVAL_ARR(result, zend_array_dup(Z_ARR_P(op1))); in add_function_array()
1031 static zend_always_inline zend_result add_function_fast(zval *result, zval *op1, zval *op2) /* {{{ … in add_function_fast() argument
1033 zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); in add_function_fast()
1036 fast_long_add_function(result, op1, op2); in add_function_fast()
1039 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); in add_function_fast()
1042 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); in add_function_fast()
1045 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); in add_function_fast()
1048 add_function_array(result, op1, op2); in add_function_fast()
1055 static zend_never_inline zend_result ZEND_FASTCALL add_function_slow(zval *result, zval *op1, zval … in add_function_slow() argument
1057 ZVAL_DEREF(op1); in add_function_slow()
1059 if (add_function_fast(result, op1, op2) == SUCCESS) { in add_function_slow()
1066 if (UNEXPECTED(zendi_try_convert_scalar_to_number(op1, &op1_copy) == FAILURE) in add_function_slow()
1068 zend_binop_error("+", op1, op2); in add_function_slow()
1069 if (result != op1) { in add_function_slow()
1075 if (result == op1) { in add_function_slow()
1087 ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2) /* {{{ */ in add_function() argument
1089 if (add_function_fast(result, op1, op2) == SUCCESS) { in add_function()
1092 return add_function_slow(result, op1, op2); in add_function()
1097 static zend_always_inline zend_result sub_function_fast(zval *result, zval *op1, zval *op2) /* {{{ … in sub_function_fast() argument
1099 zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); in sub_function_fast()
1102 fast_long_sub_function(result, op1, op2); in sub_function_fast()
1105 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); in sub_function_fast()
1108 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); in sub_function_fast()
1111 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); in sub_function_fast()
1119 static zend_never_inline zend_result ZEND_FASTCALL sub_function_slow(zval *result, zval *op1, zval … in sub_function_slow() argument
1121 ZVAL_DEREF(op1); in sub_function_slow()
1123 if (sub_function_fast(result, op1, op2) == SUCCESS) { in sub_function_slow()
1130 if (UNEXPECTED(zendi_try_convert_scalar_to_number(op1, &op1_copy) == FAILURE) in sub_function_slow()
1132 zend_binop_error("-", op1, op2); in sub_function_slow()
1133 if (result != op1) { in sub_function_slow()
1139 if (result == op1) { in sub_function_slow()
1152 ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2) /* {{{ */ in sub_function() argument
1154 if (sub_function_fast(result, op1, op2) == SUCCESS) { in sub_function()
1157 return sub_function_slow(result, op1, op2); in sub_function()
1162 static zend_always_inline zend_result mul_function_fast(zval *result, zval *op1, zval *op2) /* {{{ … in mul_function_fast() argument
1164 zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); in mul_function_fast()
1169 Z_LVAL_P(op1), Z_LVAL_P(op2), in mul_function_fast()
1174 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); in mul_function_fast()
1177 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); in mul_function_fast()
1180 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); in mul_function_fast()
1188 static zend_never_inline zend_result ZEND_FASTCALL mul_function_slow(zval *result, zval *op1, zval … in mul_function_slow() argument
1190 ZVAL_DEREF(op1); in mul_function_slow()
1192 if (mul_function_fast(result, op1, op2) == SUCCESS) { in mul_function_slow()
1199 if (UNEXPECTED(zendi_try_convert_scalar_to_number(op1, &op1_copy) == FAILURE) in mul_function_slow()
1201 zend_binop_error("*", op1, op2); in mul_function_slow()
1202 if (result != op1) { in mul_function_slow()
1208 if (result == op1) { in mul_function_slow()
1221 ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2) /* {{{ */ in mul_function() argument
1223 if (mul_function_fast(result, op1, op2) == SUCCESS) { in mul_function()
1226 return mul_function_slow(result, op1, op2); in mul_function()
1231 static zend_result ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ in pow_function_base() argument
1233 zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); in pow_function_base()
1237 zend_long l1 = 1, l2 = Z_LVAL_P(op1), i = Z_LVAL_P(op2); in pow_function_base()
1270 ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), (double)Z_LVAL_P(op2))); in pow_function_base()
1274 ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), Z_DVAL_P(op2))); in pow_function_base()
1277 ZVAL_DOUBLE(result, pow((double)Z_LVAL_P(op1), Z_DVAL_P(op2))); in pow_function_base()
1280 ZVAL_DOUBLE(result, pow(Z_DVAL_P(op1), (double)Z_LVAL_P(op2))); in pow_function_base()
1288 ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {{{ */ in pow_function() argument
1290 ZVAL_DEREF(op1); in pow_function()
1292 if (pow_function_base(result, op1, op2) == SUCCESS) { in pow_function()
1299 if (UNEXPECTED(zendi_try_convert_scalar_to_number(op1, &op1_copy) == FAILURE) in pow_function()
1301 zend_binop_error("**", op1, op2); in pow_function()
1302 if (result != op1) { in pow_function()
1308 if (result == op1) { in pow_function()
1324 static int ZEND_FASTCALL div_function_base(zval *result, zval *op1, zval *op2) /* {{{ */ in div_function_base() argument
1326 zend_uchar type_pair = TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2)); in div_function_base()
1331 } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN) { in div_function_base()
1336 if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ in div_function_base()
1337 ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); in div_function_base()
1339 ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2)); in div_function_base()
1346 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); in div_function_base()
1352 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2)); in div_function_base()
1358 ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2)); in div_function_base()
1366 ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2) /* {{{ */ in div_function() argument
1368 ZVAL_DEREF(op1); in div_function()
1371 int retval = div_function_base(result, op1, op2); in div_function()
1383 if (UNEXPECTED(zendi_try_convert_scalar_to_number(op1, &op1_copy) == FAILURE) in div_function()
1385 zend_binop_error("/", op1, op2); in div_function()
1386 if (result != op1) { in div_function()
1394 if (result == op1) { in div_function()
1403 if (result != op1) { in div_function()
1411 ZEND_API zend_result ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2) /* {{{ */ in mod_function() argument
1415 convert_op1_op2_long(op1, op1_lval, op2, op2_lval, result, ZEND_MOD, "%"); in mod_function()
1424 if (op1 != result) { in mod_function()
1430 if (op1 == result) { in mod_function()
1445 ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ … in boolean_xor_function() argument
1450 if (Z_TYPE_P(op1) == IS_FALSE) { in boolean_xor_function()
1452 } else if (EXPECTED(Z_TYPE_P(op1) == IS_TRUE)) { in boolean_xor_function()
1455 if (Z_ISREF_P(op1)) { in boolean_xor_function()
1456 op1 = Z_REFVAL_P(op1); in boolean_xor_function()
1457 if (Z_TYPE_P(op1) == IS_FALSE) { in boolean_xor_function()
1460 } else if (EXPECTED(Z_TYPE_P(op1) == IS_TRUE)) { in boolean_xor_function()
1466 op1_val = zval_is_true(op1); in boolean_xor_function()
1495 ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1) /* {{{ */ in boolean_not_function() argument
1497 if (Z_TYPE_P(op1) < IS_TRUE) { in boolean_not_function()
1499 } else if (EXPECTED(Z_TYPE_P(op1) == IS_TRUE)) { in boolean_not_function()
1502 if (Z_ISREF_P(op1)) { in boolean_not_function()
1503 op1 = Z_REFVAL_P(op1); in boolean_not_function()
1504 if (Z_TYPE_P(op1) < IS_TRUE) { in boolean_not_function()
1507 } else if (EXPECTED(Z_TYPE_P(op1) == IS_TRUE)) { in boolean_not_function()
1514 ZVAL_BOOL(result, !zval_is_true(op1)); in boolean_not_function()
1520 ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1) /* {{{ */ in bitwise_not_function() argument
1523 switch (Z_TYPE_P(op1)) { in bitwise_not_function()
1525 ZVAL_LONG(result, ~Z_LVAL_P(op1)); in bitwise_not_function()
1528 zend_long lval = zend_dval_to_lval(Z_DVAL_P(op1)); in bitwise_not_function()
1529 if (!zend_is_long_compatible(Z_DVAL_P(op1), lval)) { in bitwise_not_function()
1530 zend_incompatible_double_to_long_error(Z_DVAL_P(op1)); in bitwise_not_function()
1532 if (result != op1) { in bitwise_not_function()
1544 if (Z_STRLEN_P(op1) == 1) { in bitwise_not_function()
1545 zend_uchar not = (zend_uchar) ~*Z_STRVAL_P(op1); in bitwise_not_function()
1548 ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(op1), 0)); in bitwise_not_function()
1549 for (i = 0; i < Z_STRLEN_P(op1); i++) { in bitwise_not_function()
1550 Z_STRVAL_P(result)[i] = ~Z_STRVAL_P(op1)[i]; in bitwise_not_function()
1557 op1 = Z_REFVAL_P(op1); in bitwise_not_function()
1562 if (result != op1) { in bitwise_not_function()
1565 zend_type_error("Cannot perform bitwise not on %s", zend_zval_type_name(op1)); in bitwise_not_function()
1571 ZEND_API zend_result ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2) /* {{{ */ in bitwise_or_function() argument
1575 if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { in bitwise_or_function()
1576 ZVAL_LONG(result, Z_LVAL_P(op1) | Z_LVAL_P(op2)); in bitwise_or_function()
1580 ZVAL_DEREF(op1); in bitwise_or_function()
1583 if (Z_TYPE_P(op1) == IS_STRING && EXPECTED(Z_TYPE_P(op2) == IS_STRING)) { in bitwise_or_function()
1588 if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) { in bitwise_or_function()
1589 if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) { in bitwise_or_function()
1590 zend_uchar or = (zend_uchar) (*Z_STRVAL_P(op1) | *Z_STRVAL_P(op2)); in bitwise_or_function()
1591 if (result==op1) { in bitwise_or_function()
1597 longer = op1; in bitwise_or_function()
1601 shorter = op1; in bitwise_or_function()
1609 if (result==op1) { in bitwise_or_function()
1616 if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) { in bitwise_or_function()
1619 op1_lval = zendi_try_get_long(op1, &failed); in bitwise_or_function()
1621 zend_binop_error("|", op1, op2); in bitwise_or_function()
1622 if (result != op1) { in bitwise_or_function()
1628 op1_lval = Z_LVAL_P(op1); in bitwise_or_function()
1635 zend_binop_error("|", op1, op2); in bitwise_or_function()
1636 if (result != op1) { in bitwise_or_function()
1645 if (op1 == result) { in bitwise_or_function()
1653 ZEND_API zend_result ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2) /* {{{ … in bitwise_and_function() argument
1657 if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { in bitwise_and_function()
1658 ZVAL_LONG(result, Z_LVAL_P(op1) & Z_LVAL_P(op2)); in bitwise_and_function()
1662 ZVAL_DEREF(op1); in bitwise_and_function()
1665 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_and_function()
1670 if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) { in bitwise_and_function()
1671 if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) { in bitwise_and_function()
1672 zend_uchar and = (zend_uchar) (*Z_STRVAL_P(op1) & *Z_STRVAL_P(op2)); in bitwise_and_function()
1673 if (result==op1) { in bitwise_and_function()
1679 longer = op1; in bitwise_and_function()
1683 shorter = op1; in bitwise_and_function()
1691 if (result==op1) { in bitwise_and_function()
1698 if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) { in bitwise_and_function()
1701 op1_lval = zendi_try_get_long(op1, &failed); in bitwise_and_function()
1703 zend_binop_error("&", op1, op2); in bitwise_and_function()
1704 if (result != op1) { in bitwise_and_function()
1710 op1_lval = Z_LVAL_P(op1); in bitwise_and_function()
1717 zend_binop_error("&", op1, op2); in bitwise_and_function()
1718 if (result != op1) { in bitwise_and_function()
1727 if (op1 == result) { in bitwise_and_function()
1735 ZEND_API zend_result ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2) /* {{{ … in bitwise_xor_function() argument
1739 if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { in bitwise_xor_function()
1740 ZVAL_LONG(result, Z_LVAL_P(op1) ^ Z_LVAL_P(op2)); in bitwise_xor_function()
1744 ZVAL_DEREF(op1); in bitwise_xor_function()
1747 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_xor_function()
1752 if (EXPECTED(Z_STRLEN_P(op1) >= Z_STRLEN_P(op2))) { in bitwise_xor_function()
1753 if (EXPECTED(Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) && Z_STRLEN_P(op1) == 1) { in bitwise_xor_function()
1754 zend_uchar xor = (zend_uchar) (*Z_STRVAL_P(op1) ^ *Z_STRVAL_P(op2)); in bitwise_xor_function()
1755 if (result==op1) { in bitwise_xor_function()
1761 longer = op1; in bitwise_xor_function()
1765 shorter = op1; in bitwise_xor_function()
1773 if (result==op1) { in bitwise_xor_function()
1780 if (UNEXPECTED(Z_TYPE_P(op1) != IS_LONG)) { in bitwise_xor_function()
1783 op1_lval = zendi_try_get_long(op1, &failed); in bitwise_xor_function()
1785 zend_binop_error("^", op1, op2); in bitwise_xor_function()
1786 if (result != op1) { in bitwise_xor_function()
1792 op1_lval = Z_LVAL_P(op1); in bitwise_xor_function()
1799 zend_binop_error("^", op1, op2); in bitwise_xor_function()
1800 if (result != op1) { in bitwise_xor_function()
1809 if (op1 == result) { in bitwise_xor_function()
1817 ZEND_API zend_result ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2) /* {{{ */ in shift_left_function() argument
1821 convert_op1_op2_long(op1, op1_lval, op2, op2_lval, result, ZEND_SL, "<<"); in shift_left_function()
1826 if (op1 == result) { in shift_left_function()
1837 if (op1 != result) { in shift_left_function()
1844 if (op1 == result) { in shift_left_function()
1854 ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2) /* {{{ … in shift_right_function() argument
1858 convert_op1_op2_long(op1, op1_lval, op2, op2_lval, result, ZEND_SR, ">>"); in shift_right_function()
1863 if (op1 == result) { in shift_right_function()
1874 if (op1 != result) { in shift_right_function()
1881 if (op1 == result) { in shift_right_function()
1890 ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /* {{{ */ in concat_function() argument
1892 zval *orig_op1 = op1; in concat_function()
1899 if (UNEXPECTED(Z_TYPE_P(op1) != IS_STRING)) { in concat_function()
1900 if (Z_ISREF_P(op1)) { in concat_function()
1901 op1 = Z_REFVAL_P(op1); in concat_function()
1902 if (Z_TYPE_P(op1) == IS_STRING) break; in concat_function()
1905 ZVAL_STR(&op1_copy, zval_get_string_func(op1)); in concat_function()
1913 if (result == op1) { in concat_function()
1914 if (UNEXPECTED(op1 == op2)) { in concat_function()
1918 op1 = &op1_copy; in concat_function()
1941 if (UNEXPECTED(Z_STRLEN_P(op1) == 0)) { in concat_function()
1949 if (EXPECTED(result != op1)) { in concat_function()
1953 ZVAL_COPY(result, op1); in concat_function()
1956 size_t op1_len = Z_STRLEN_P(op1); in concat_function()
1971 if (result == op1 && Z_REFCOUNTED_P(result)) { in concat_function()
1976 memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len); in concat_function()
1997 ZEND_API int ZEND_FASTCALL string_compare_function_ex(zval *op1, zval *op2, bool case_insensitive) … in string_compare_function_ex() argument
2000 zend_string *str1 = zval_get_tmp_string(op1, &tmp_str1); in string_compare_function_ex()
2016 ZEND_API int ZEND_FASTCALL string_compare_function(zval *op1, zval *op2) /* {{{ */ in string_compare_function() argument
2018 if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) && in string_compare_function()
2020 if (Z_STR_P(op1) == Z_STR_P(op2)) { in string_compare_function()
2023 return zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in string_compare_function()
2027 zend_string *str1 = zval_get_tmp_string(op1, &tmp_str1); in string_compare_function()
2038 ZEND_API int ZEND_FASTCALL string_case_compare_function(zval *op1, zval *op2) /* {{{ */ in string_case_compare_function() argument
2040 if (EXPECTED(Z_TYPE_P(op1) == IS_STRING) && in string_case_compare_function()
2042 if (Z_STR_P(op1) == Z_STR_P(op2)) { in string_case_compare_function()
2045 … return zend_binary_strcasecmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in string_case_compare_function()
2049 zend_string *str1 = zval_get_tmp_string(op1, &tmp_str1); in string_case_compare_function()
2060 ZEND_API int ZEND_FASTCALL string_locale_compare_function(zval *op1, zval *op2) /* {{{ */ in string_locale_compare_function() argument
2063 zend_string *str1 = zval_get_tmp_string(op1, &tmp_str1); in string_locale_compare_function()
2073 ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{ */ in numeric_compare_function() argument
2077 d1 = zval_get_double(op1); in numeric_compare_function()
2084 ZEND_API zend_result ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */ in compare_function() argument
2086 ZVAL_LONG(result, zend_compare(op1, op2)); in compare_function()
2140 ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */ in zend_compare() argument
2146 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in zend_compare()
2148 return Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0); in zend_compare()
2151 return ZEND_NORMALIZE_BOOL(Z_DVAL_P(op1) - (double)Z_LVAL_P(op2)); in zend_compare()
2154 return ZEND_NORMALIZE_BOOL((double)Z_LVAL_P(op1) - Z_DVAL_P(op2)); in zend_compare()
2157 if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) { in zend_compare()
2160 return ZEND_NORMALIZE_BOOL(Z_DVAL_P(op1) - Z_DVAL_P(op2)); in zend_compare()
2164 return zend_compare_arrays(op1, op2); in zend_compare()
2180 if (Z_STR_P(op1) == Z_STR_P(op2)) { in zend_compare()
2183 return zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)); in zend_compare()
2189 return Z_STRLEN_P(op1) == 0 ? 0 : 1; in zend_compare()
2192 return compare_long_to_string(Z_LVAL_P(op1), Z_STR_P(op2)); in zend_compare()
2195 return -compare_long_to_string(Z_LVAL_P(op2), Z_STR_P(op1)); in zend_compare()
2198 if (zend_isnan(Z_DVAL_P(op1))) { in zend_compare()
2202 return compare_double_to_string(Z_DVAL_P(op1), Z_STR_P(op2)); in zend_compare()
2209 return -compare_double_to_string(Z_DVAL_P(op2), Z_STR_P(op1)); in zend_compare()
2218 if (Z_ISREF_P(op1)) { in zend_compare()
2219 op1 = Z_REFVAL_P(op1); in zend_compare()
2226 if (Z_TYPE_P(op1) == IS_OBJECT in zend_compare()
2228 && Z_OBJ_P(op1) == Z_OBJ_P(op2)) { in zend_compare()
2230 } else if (Z_TYPE_P(op1) == IS_OBJECT) { in zend_compare()
2231 return Z_OBJ_HANDLER_P(op1, compare)(op1, op2); in zend_compare()
2233 return Z_OBJ_HANDLER_P(op2, compare)(op1, op2); in zend_compare()
2237 if (Z_TYPE_P(op1) < IS_TRUE) { in zend_compare()
2239 } else if (Z_TYPE_P(op1) == IS_TRUE) { in zend_compare()
2242 return zval_is_true(op1) ? 1 : 0; in zend_compare()
2244 return zval_is_true(op1) ? 0 : -1; in zend_compare()
2246 op1 = _zendi_convert_scalar_to_number_silent(op1, &op1_copy); in zend_compare()
2253 } else if (Z_TYPE_P(op1)==IS_ARRAY) { in zend_compare()
2281 ZEND_API bool ZEND_FASTCALL zend_is_identical(zval *op1, zval *op2) /* {{{ */ in zend_is_identical() argument
2283 if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { in zend_is_identical()
2286 switch (Z_TYPE_P(op1)) { in zend_is_identical()
2292 return (Z_LVAL_P(op1) == Z_LVAL_P(op2)); in zend_is_identical()
2294 return (Z_RES_P(op1) == Z_RES_P(op2)); in zend_is_identical()
2296 return (Z_DVAL_P(op1) == Z_DVAL_P(op2)); in zend_is_identical()
2298 return zend_string_equals(Z_STR_P(op1), Z_STR_P(op2)); in zend_is_identical()
2300 return (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || in zend_is_identical()
2301 …zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function,… in zend_is_identical()
2303 return (Z_OBJ_P(op1) == Z_OBJ_P(op2)); in zend_is_identical()
2310 ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2) /* {{{… in is_identical_function() argument
2312 ZVAL_BOOL(result, zend_is_identical(op1, op2)); in is_identical_function()
2317 ZEND_API zend_result ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /*… in is_not_identical_function() argument
2319 ZVAL_BOOL(result, !zend_is_identical(op1, op2)); in is_not_identical_function()
2324 ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ in is_equal_function() argument
2326 ZVAL_BOOL(result, zend_compare(op1, op2) == 0); in is_equal_function()
2331 ZEND_API zend_result ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{… in is_not_equal_function() argument
2333 ZVAL_BOOL(result, (zend_compare(op1, op2) != 0)); in is_not_equal_function()
2338 ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ in is_smaller_function() argument
2340 ZVAL_BOOL(result, (zend_compare(op1, op2) < 0)); in is_smaller_function()
2345 ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2)… in is_smaller_or_equal_function() argument
2347 ZVAL_BOOL(result, (zend_compare(op1, op2) <= 0)); in is_smaller_or_equal_function()
2489 ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1) /* {{{ */ in increment_function() argument
2492 switch (Z_TYPE_P(op1)) { in increment_function()
2494 fast_long_increment_function(op1); in increment_function()
2497 Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; in increment_function()
2500 ZVAL_LONG(op1, 1); in increment_function()
2506 switch (is_numeric_str_function(Z_STR_P(op1), &lval, &dval)) { in increment_function()
2508 zval_ptr_dtor_str(op1); in increment_function()
2512 ZVAL_DOUBLE(op1, d+1); in increment_function()
2514 ZVAL_LONG(op1, lval+1); in increment_function()
2518 zval_ptr_dtor_str(op1); in increment_function()
2519 ZVAL_DOUBLE(op1, dval+1); in increment_function()
2523 increment_string(op1); in increment_function()
2533 op1 = Z_REFVAL_P(op1); in increment_function()
2536 if (Z_OBJ_HANDLER_P(op1, do_operation)) { in increment_function()
2539 if (Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_ADD, op1, op1, &op2) == SUCCESS) { in increment_function()
2546 zend_type_error("Cannot increment %s", zend_zval_type_name(op1)); in increment_function()
2554 ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */ in decrement_function() argument
2560 switch (Z_TYPE_P(op1)) { in decrement_function()
2562 fast_long_decrement_function(op1); in decrement_function()
2565 Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; in decrement_function()
2568 if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ in decrement_function()
2569 zval_ptr_dtor_str(op1); in decrement_function()
2570 ZVAL_LONG(op1, -1); in decrement_function()
2573 switch (is_numeric_str_function(Z_STR_P(op1), &lval, &dval)) { in decrement_function()
2575 zval_ptr_dtor_str(op1); in decrement_function()
2578 ZVAL_DOUBLE(op1, d-1); in decrement_function()
2580 ZVAL_LONG(op1, lval-1); in decrement_function()
2584 zval_ptr_dtor_str(op1); in decrement_function()
2585 ZVAL_DOUBLE(op1, dval - 1); in decrement_function()
2595 op1 = Z_REFVAL_P(op1); in decrement_function()
2598 if (Z_OBJ_HANDLER_P(op1, do_operation)) { in decrement_function()
2601 if (Z_OBJ_HANDLER_P(op1, do_operation)(ZEND_SUB, op1, op1, &op2) == SUCCESS) { in decrement_function()
2608 zend_type_error("Cannot decrement %s", zend_zval_type_name(op1)); in decrement_function()