Lines Matching refs:op1
810 ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in add_function() argument
816 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in add_function()
818 long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2); in add_function()
821 if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) in add_function()
822 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { in add_function()
824 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); in add_function()
832 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); in add_function()
836 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); in add_function()
840 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); in add_function()
846 if ((result == op1) && (result == op2)) { in add_function()
850 if (result != op1) { in add_function()
851 *result = *op1; in add_function()
860 zendi_convert_scalar_to_number(op1, op1_copy, result); in add_function()
872 ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in sub_function() argument
878 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in sub_function()
880 long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2); in sub_function()
883 if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) in sub_function()
884 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { in sub_function()
886 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); in sub_function()
894 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); in sub_function()
898 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); in sub_function()
902 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); in sub_function()
907 zendi_convert_scalar_to_number(op1, op1_copy, result); in sub_function()
919 ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in mul_function() argument
925 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in mul_function()
929 …ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); in mul_function()
935 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); in mul_function()
939 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); in mul_function()
943 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); in mul_function()
948 zendi_convert_scalar_to_number(op1, op1_copy, result); in mul_function()
960 ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in div_function() argument
966 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in div_function()
972 } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { in div_function()
977 if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ in div_function()
978 ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); in div_function()
980 ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2)); in div_function()
990 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2)); in div_function()
999 ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2)); in div_function()
1008 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); in div_function()
1013 zendi_convert_scalar_to_number(op1, op1_copy, result); in div_function()
1025 ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in mod_function() argument
1030 zendi_convert_to_long(op1, op1_copy, result); in mod_function()
1031 op1_lval = Z_LVAL_P(op1); in mod_function()
1051 ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in boolean_xor_function() argument
1056 zendi_convert_to_boolean(op1, op1_copy, result); in boolean_xor_function()
1057 op1_lval = Z_LVAL_P(op1); in boolean_xor_function()
1064 ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ in boolean_not_function()
1068 zendi_convert_to_boolean(op1, op1_copy, result); in boolean_not_function()
1069 ZVAL_BOOL(result, !Z_LVAL_P(op1)); in boolean_not_function()
1074 ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ in bitwise_not_function()
1076 zval op1_copy = *op1; in bitwise_not_function()
1078 op1 = &op1_copy; in bitwise_not_function()
1080 if (Z_TYPE_P(op1) == IS_LONG) { in bitwise_not_function()
1081 ZVAL_LONG(result, ~Z_LVAL_P(op1)); in bitwise_not_function()
1083 } else if (Z_TYPE_P(op1) == IS_DOUBLE) { in bitwise_not_function()
1084 ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1))); in bitwise_not_function()
1086 } else if (Z_TYPE_P(op1) == IS_STRING) { in bitwise_not_function()
1090 Z_STRVAL_P(result) = estrndup(Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in bitwise_not_function()
1091 Z_STRLEN_P(result) = Z_STRLEN_P(op1); in bitwise_not_function()
1092 for (i = 0; i < Z_STRLEN_P(op1); i++) { in bitwise_not_function()
1093 Z_STRVAL_P(result)[i] = ~Z_STRVAL_P(op1)[i]; in bitwise_not_function()
1102 ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_or_function() argument
1107 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_or_function()
1112 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_or_function()
1113 longer = op1; in bitwise_or_function()
1117 shorter = op1; in bitwise_or_function()
1126 if (result==op1) { in bitwise_or_function()
1133 zendi_convert_to_long(op1, op1_copy, result); in bitwise_or_function()
1134 op1_lval = Z_LVAL_P(op1); in bitwise_or_function()
1142 ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_and_function() argument
1147 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_and_function()
1152 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_and_function()
1153 longer = op1; in bitwise_and_function()
1157 shorter = op1; in bitwise_and_function()
1166 if (result==op1) { in bitwise_and_function()
1175 zendi_convert_to_long(op1, op1_copy, result); in bitwise_and_function()
1176 op1_lval = Z_LVAL_P(op1); in bitwise_and_function()
1184 ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_xor_function() argument
1189 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_xor_function()
1194 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_xor_function()
1195 longer = op1; in bitwise_xor_function()
1199 shorter = op1; in bitwise_xor_function()
1208 if (result==op1) { in bitwise_xor_function()
1216 zendi_convert_to_long(op1, op1_copy, result); in bitwise_xor_function()
1217 op1_lval = Z_LVAL_P(op1); in bitwise_xor_function()
1225 ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in shift_left_function() argument
1230 zendi_convert_to_long(op1, op1_copy, result); in shift_left_function()
1231 op1_lval = Z_LVAL_P(op1); in shift_left_function()
1238 ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in shift_right_function() argument
1243 zendi_convert_to_long(op1, op1_copy, result); in shift_right_function()
1244 op1_lval = Z_LVAL_P(op1); in shift_right_function()
1252 ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ in add_char_to_string() argument
1254 int length = Z_STRLEN_P(op1) + 1; in add_char_to_string()
1261 if (IS_INTERNED(Z_STRVAL_P(op1))) { in add_char_to_string()
1263 memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in add_char_to_string()
1265 buf = (char *) erealloc(Z_STRVAL_P(op1), length + 1); in add_char_to_string()
1275 ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ in add_string_to_string() argument
1277 int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in add_string_to_string()
1283 if (IS_INTERNED(Z_STRVAL_P(op1))) { in add_string_to_string()
1285 memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in add_string_to_string()
1287 buf = (char *) erealloc(Z_STRVAL_P(op1), length+1); in add_string_to_string()
1289 memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in add_string_to_string()
1296 ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in concat_function() argument
1301 if (Z_TYPE_P(op1) != IS_STRING) { in concat_function()
1302 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in concat_function()
1312 if (result == op1) { in concat_function()
1313 zval_dtor(op1); in concat_function()
1315 op1 = &op1_copy; in concat_function()
1320 …if (result==op1 && !IS_INTERNED(Z_STRVAL_P(op1))) { /* special case, perform operations on result … in concat_function()
1321 uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in concat_function()
1323 if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { in concat_function()
1335 int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in concat_function()
1338 if (Z_STRLEN_P(op1) < 0 || Z_STRLEN_P(op2) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { in concat_function()
1343 memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in concat_function()
1344 memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in concat_function()
1349 zval_dtor(op1); in concat_function()
1358 ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensit… in string_compare_function_ex() argument
1363 if (Z_TYPE_P(op1) != IS_STRING) { in string_compare_function_ex()
1364 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in string_compare_function_ex()
1371 op1 = &op1_copy; in string_compare_function_ex()
1378 ZVAL_LONG(result, zend_binary_zval_strcasecmp(op1, op2)); in string_compare_function_ex()
1380 ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); in string_compare_function_ex()
1384 zval_dtor(op1); in string_compare_function_ex()
1393 ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_compare_function() argument
1395 return string_compare_function_ex(result, op1, op2, 0 TSRMLS_CC); in string_compare_function()
1399 ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_case_compare_function() argument
1401 return string_compare_function_ex(result, op1, op2, 1 TSRMLS_CC); in string_case_compare_function()
1406 ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_locale_compare_function() argument
1411 if (Z_TYPE_P(op1) != IS_STRING) { in string_locale_compare_function()
1412 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in string_locale_compare_function()
1419 op1 = &op1_copy; in string_locale_compare_function()
1425 ZVAL_LONG(result, strcoll(Z_STRVAL_P(op1), Z_STRVAL_P(op2))); in string_locale_compare_function()
1428 zval_dtor(op1); in string_locale_compare_function()
1438 ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in numeric_compare_function() argument
1442 op1_copy = *op1; in numeric_compare_function()
1469 ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in compare_function() argument
1477 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in compare_function()
1479 ZVAL_LONG(result, Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0)); in compare_function()
1483 Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2); in compare_function()
1488 Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2); in compare_function()
1493 if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) { in compare_function()
1496 Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2); in compare_function()
1502 zend_compare_arrays(result, op1, op2 TSRMLS_CC); in compare_function()
1514 ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); in compare_function()
1518 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1522 zendi_smart_strcmp(result, op1, op2); in compare_function()
1530 ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0)); in compare_function()
1543 if (Z_OBJ_HANDLER_P(op1,compare_objects) == Z_OBJ_HANDLER_P(op2,compare_objects)) { in compare_function()
1544 if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { in compare_function()
1549 ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC)); in compare_function()
1555 if (Z_TYPE_P(op1) == IS_OBJECT) { in compare_function()
1556 if (Z_OBJ_HT_P(op1)->get) { in compare_function()
1557 op_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC); in compare_function()
1561 } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) { in compare_function()
1563 if (Z_OBJ_HT_P(op1)->cast_object(op1, op_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) { in compare_function()
1576 ret = compare_function(result, op1, op_free TSRMLS_CC); in compare_function()
1579 } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) { in compare_function()
1581 if (Z_OBJ_HT_P(op2)->cast_object(op2, op_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) { in compare_function()
1586 ret = compare_function(result, op1, op_free TSRMLS_CC); in compare_function()
1589 } else if (Z_TYPE_P(op1) == IS_OBJECT) { in compare_function()
1595 if (Z_TYPE_P(op1) == IS_NULL) { in compare_function()
1600 zendi_convert_to_boolean(op1, op1_copy, result); in compare_function()
1601 ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); in compare_function()
1603 } else if (Z_TYPE_P(op1) == IS_BOOL) { in compare_function()
1605 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1608 zendi_convert_to_boolean(op1, op1_copy, result); in compare_function()
1609 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1612 zendi_convert_scalar_to_number(op1, op1_copy, result); in compare_function()
1616 } else if (Z_TYPE_P(op1)==IS_ARRAY) { in compare_function()
1622 } else if (Z_TYPE_P(op1)==IS_OBJECT) { in compare_function()
1654 ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_identical_function() argument
1657 if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { in is_identical_function()
1661 switch (Z_TYPE_P(op1)) { in is_identical_function()
1668 Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2)); in is_identical_function()
1671 Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); in is_identical_function()
1674 Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) in is_identical_function()
1675 && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); in is_identical_function()
1678 Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || in is_identical_function()
1679 …zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function,… in is_identical_function()
1682 if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { in is_identical_function()
1683 Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); in is_identical_function()
1696 ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_not_identical_function() argument
1698 if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_not_identical_function()
1706 ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_equal_function() argument
1708 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_equal_function()
1716 ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_not_equal_function() argument
1718 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_not_equal_function()
1726 ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_smaller_function() argument
1728 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_smaller_function()
1736 ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_smaller_or_equal_function() argument
1738 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_smaller_or_equal_function()
1861 ZEND_API int increment_function(zval *op1) /* {{{ */ in increment_function() argument
1863 switch (Z_TYPE_P(op1)) { in increment_function()
1865 if (Z_LVAL_P(op1) == LONG_MAX) { in increment_function()
1867 double d = (double)Z_LVAL_P(op1); in increment_function()
1868 ZVAL_DOUBLE(op1, d+1); in increment_function()
1870 Z_LVAL_P(op1)++; in increment_function()
1874 Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; in increment_function()
1877 ZVAL_LONG(op1, 1); in increment_function()
1883 switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { in increment_function()
1885 str_efree(Z_STRVAL_P(op1)); in increment_function()
1889 ZVAL_DOUBLE(op1, d+1); in increment_function()
1891 ZVAL_LONG(op1, lval+1); in increment_function()
1895 str_efree(Z_STRVAL_P(op1)); in increment_function()
1896 ZVAL_DOUBLE(op1, dval+1); in increment_function()
1900 increment_string(op1); in increment_function()
1912 ZEND_API int decrement_function(zval *op1) /* {{{ */ in decrement_function() argument
1917 switch (Z_TYPE_P(op1)) { in decrement_function()
1919 if (Z_LVAL_P(op1) == LONG_MIN) { in decrement_function()
1920 double d = (double)Z_LVAL_P(op1); in decrement_function()
1921 ZVAL_DOUBLE(op1, d-1); in decrement_function()
1923 Z_LVAL_P(op1)--; in decrement_function()
1927 Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; in decrement_function()
1930 if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ in decrement_function()
1931 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1932 ZVAL_LONG(op1, -1); in decrement_function()
1935 switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { in decrement_function()
1937 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1940 ZVAL_DOUBLE(op1, d-1); in decrement_function()
1942 ZVAL_LONG(op1, lval-1); in decrement_function()
1946 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1947 ZVAL_DOUBLE(op1, dval - 1); in decrement_function()