Lines Matching refs:op1

755 ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */  in add_function()  argument
761 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in add_function()
763 long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2); in add_function()
766 if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) in add_function()
767 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { in add_function()
769 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); in add_function()
777 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); in add_function()
781 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); in add_function()
785 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); in add_function()
791 if ((result == op1) && (result == op2)) { in add_function()
795 if (result != op1) { in add_function()
796 *result = *op1; in add_function()
805 zendi_convert_scalar_to_number(op1, op1_copy, result); in add_function()
817 ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in sub_function() argument
823 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in sub_function()
825 long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2); in sub_function()
828 if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) in sub_function()
829 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { in sub_function()
831 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); in sub_function()
839 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); in sub_function()
843 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); in sub_function()
847 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); in sub_function()
852 zendi_convert_scalar_to_number(op1, op1_copy, result); in sub_function()
864 ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in mul_function() argument
870 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in mul_function()
874 …ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); in mul_function()
880 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); in mul_function()
884 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); in mul_function()
888 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); in mul_function()
893 zendi_convert_scalar_to_number(op1, op1_copy, result); in mul_function()
905 ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in div_function() argument
911 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in div_function()
917 } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { in div_function()
922 if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ in div_function()
923 ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); in div_function()
925 ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2)); in div_function()
935 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2)); in div_function()
944 ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2)); in div_function()
953 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); in div_function()
958 zendi_convert_scalar_to_number(op1, op1_copy, result); in div_function()
970 ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in mod_function() argument
975 zendi_convert_to_long(op1, op1_copy, result); in mod_function()
976 op1_lval = Z_LVAL_P(op1); in mod_function()
996 ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in boolean_xor_function() argument
1001 zendi_convert_to_boolean(op1, op1_copy, result); in boolean_xor_function()
1002 op1_lval = Z_LVAL_P(op1); in boolean_xor_function()
1009 ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ in boolean_not_function()
1013 zendi_convert_to_boolean(op1, op1_copy, result); in boolean_not_function()
1014 ZVAL_BOOL(result, !Z_LVAL_P(op1)); in boolean_not_function()
1019 ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ in bitwise_not_function()
1021 zval op1_copy = *op1; in bitwise_not_function()
1023 op1 = &op1_copy; in bitwise_not_function()
1025 if (Z_TYPE_P(op1) == IS_LONG) { in bitwise_not_function()
1026 ZVAL_LONG(result, ~Z_LVAL_P(op1)); in bitwise_not_function()
1028 } else if (Z_TYPE_P(op1) == IS_DOUBLE) { in bitwise_not_function()
1029 ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1))); in bitwise_not_function()
1031 } else if (Z_TYPE_P(op1) == IS_STRING) { in bitwise_not_function()
1035 Z_STRVAL_P(result) = estrndup(Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in bitwise_not_function()
1036 Z_STRLEN_P(result) = Z_STRLEN_P(op1); in bitwise_not_function()
1037 for (i = 0; i < Z_STRLEN_P(op1); i++) { in bitwise_not_function()
1038 Z_STRVAL_P(result)[i] = ~Z_STRVAL_P(op1)[i]; in bitwise_not_function()
1047 ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_or_function() argument
1052 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_or_function()
1057 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_or_function()
1058 longer = op1; in bitwise_or_function()
1062 shorter = op1; in bitwise_or_function()
1071 if (result==op1) { in bitwise_or_function()
1078 zendi_convert_to_long(op1, op1_copy, result); in bitwise_or_function()
1079 op1_lval = Z_LVAL_P(op1); in bitwise_or_function()
1087 ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_and_function() argument
1092 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_and_function()
1097 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_and_function()
1098 longer = op1; in bitwise_and_function()
1102 shorter = op1; in bitwise_and_function()
1111 if (result==op1) { in bitwise_and_function()
1120 zendi_convert_to_long(op1, op1_copy, result); in bitwise_and_function()
1121 op1_lval = Z_LVAL_P(op1); in bitwise_and_function()
1129 ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_xor_function() argument
1134 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_xor_function()
1139 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_xor_function()
1140 longer = op1; in bitwise_xor_function()
1144 shorter = op1; in bitwise_xor_function()
1153 if (result==op1) { in bitwise_xor_function()
1161 zendi_convert_to_long(op1, op1_copy, result); in bitwise_xor_function()
1162 op1_lval = Z_LVAL_P(op1); in bitwise_xor_function()
1170 ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in shift_left_function() argument
1175 zendi_convert_to_long(op1, op1_copy, result); in shift_left_function()
1176 op1_lval = Z_LVAL_P(op1); in shift_left_function()
1183 ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in shift_right_function() argument
1188 zendi_convert_to_long(op1, op1_copy, result); in shift_right_function()
1189 op1_lval = Z_LVAL_P(op1); in shift_right_function()
1197 ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ in add_char_to_string() argument
1199 int length = Z_STRLEN_P(op1) + 1; in add_char_to_string()
1202 if (IS_INTERNED(Z_STRVAL_P(op1))) { in add_char_to_string()
1204 memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in add_char_to_string()
1206 buf = (char *) erealloc(Z_STRVAL_P(op1), length + 1); in add_char_to_string()
1216 ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ in add_string_to_string() argument
1218 int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in add_string_to_string()
1221 if (IS_INTERNED(Z_STRVAL_P(op1))) { in add_string_to_string()
1223 memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in add_string_to_string()
1225 buf = (char *) erealloc(Z_STRVAL_P(op1), length+1); in add_string_to_string()
1227 memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in add_string_to_string()
1234 ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in concat_function() argument
1239 if (Z_TYPE_P(op1) != IS_STRING) { in concat_function()
1240 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in concat_function()
1250 if (result == op1) { in concat_function()
1251 zval_dtor(op1); in concat_function()
1253 op1 = &op1_copy; in concat_function()
1258 …if (result==op1 && !IS_INTERNED(Z_STRVAL_P(op1))) { /* special case, perform operations on result … in concat_function()
1259 uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in concat_function()
1261 if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { in concat_function()
1273 int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in concat_function()
1276 if (Z_STRLEN_P(op1) < 0 || Z_STRLEN_P(op2) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { in concat_function()
1281 memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in concat_function()
1282 memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in concat_function()
1287 zval_dtor(op1); in concat_function()
1296 ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensit… in string_compare_function_ex() argument
1301 if (Z_TYPE_P(op1) != IS_STRING) { in string_compare_function_ex()
1302 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in string_compare_function_ex()
1309 op1 = &op1_copy; in string_compare_function_ex()
1316 ZVAL_LONG(result, zend_binary_zval_strcasecmp(op1, op2)); in string_compare_function_ex()
1318 ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); in string_compare_function_ex()
1322 zval_dtor(op1); in string_compare_function_ex()
1331 ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_compare_function() argument
1333 return string_compare_function_ex(result, op1, op2, 0 TSRMLS_CC); in string_compare_function()
1337 ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_case_compare_function() argument
1339 return string_compare_function_ex(result, op1, op2, 1 TSRMLS_CC); in string_case_compare_function()
1344 ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_locale_compare_function() argument
1349 if (Z_TYPE_P(op1) != IS_STRING) { in string_locale_compare_function()
1350 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in string_locale_compare_function()
1357 op1 = &op1_copy; in string_locale_compare_function()
1363 ZVAL_LONG(result, strcoll(Z_STRVAL_P(op1), Z_STRVAL_P(op2))); in string_locale_compare_function()
1366 zval_dtor(op1); in string_locale_compare_function()
1376 ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in numeric_compare_function() argument
1380 op1_copy = *op1; in numeric_compare_function()
1407 ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in compare_function() argument
1415 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in compare_function()
1417 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()
1421 Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2); in compare_function()
1426 Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2); in compare_function()
1431 if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) { in compare_function()
1434 Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2); in compare_function()
1440 zend_compare_arrays(result, op1, op2 TSRMLS_CC); in compare_function()
1452 ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); in compare_function()
1456 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1460 zendi_smart_strcmp(result, op1, op2); in compare_function()
1468 ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0)); in compare_function()
1481 if (Z_OBJ_HANDLER_P(op1,compare_objects) == Z_OBJ_HANDLER_P(op2,compare_objects)) { in compare_function()
1482 if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { in compare_function()
1487 ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC)); in compare_function()
1493 if (Z_TYPE_P(op1) == IS_OBJECT) { in compare_function()
1494 if (Z_OBJ_HT_P(op1)->get) { in compare_function()
1495 op_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC); in compare_function()
1499 } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) { in compare_function()
1501 if (Z_OBJ_HT_P(op1)->cast_object(op1, op_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) { in compare_function()
1514 ret = compare_function(result, op1, op_free TSRMLS_CC); in compare_function()
1517 } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) { in compare_function()
1519 if (Z_OBJ_HT_P(op2)->cast_object(op2, op_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) { in compare_function()
1524 ret = compare_function(result, op1, op_free TSRMLS_CC); in compare_function()
1527 } else if (Z_TYPE_P(op1) == IS_OBJECT) { in compare_function()
1533 if (Z_TYPE_P(op1) == IS_NULL) { in compare_function()
1538 zendi_convert_to_boolean(op1, op1_copy, result); in compare_function()
1539 ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); in compare_function()
1541 } else if (Z_TYPE_P(op1) == IS_BOOL) { in compare_function()
1543 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1546 zendi_convert_to_boolean(op1, op1_copy, result); in compare_function()
1547 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1550 zendi_convert_scalar_to_number(op1, op1_copy, result); in compare_function()
1554 } else if (Z_TYPE_P(op1)==IS_ARRAY) { in compare_function()
1560 } else if (Z_TYPE_P(op1)==IS_OBJECT) { in compare_function()
1592 ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_identical_function() argument
1595 if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { in is_identical_function()
1599 switch (Z_TYPE_P(op1)) { in is_identical_function()
1606 Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2)); in is_identical_function()
1609 Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); in is_identical_function()
1612 Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) in is_identical_function()
1613 && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); in is_identical_function()
1616 Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || in is_identical_function()
1617 …zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function,… in is_identical_function()
1620 if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { in is_identical_function()
1621 Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); in is_identical_function()
1634 ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_not_identical_function() argument
1636 if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_not_identical_function()
1644 ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_equal_function() argument
1646 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_equal_function()
1654 ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_not_equal_function() argument
1656 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_not_equal_function()
1664 ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_smaller_function() argument
1666 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_smaller_function()
1674 ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_smaller_or_equal_function() argument
1676 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_smaller_or_equal_function()
1799 ZEND_API int increment_function(zval *op1) /* {{{ */ in increment_function() argument
1801 switch (Z_TYPE_P(op1)) { in increment_function()
1803 if (Z_LVAL_P(op1) == LONG_MAX) { in increment_function()
1805 double d = (double)Z_LVAL_P(op1); in increment_function()
1806 ZVAL_DOUBLE(op1, d+1); in increment_function()
1808 Z_LVAL_P(op1)++; in increment_function()
1812 Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; in increment_function()
1815 ZVAL_LONG(op1, 1); in increment_function()
1821 switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { in increment_function()
1823 str_efree(Z_STRVAL_P(op1)); in increment_function()
1827 ZVAL_DOUBLE(op1, d+1); in increment_function()
1829 ZVAL_LONG(op1, lval+1); in increment_function()
1833 str_efree(Z_STRVAL_P(op1)); in increment_function()
1834 ZVAL_DOUBLE(op1, dval+1); in increment_function()
1838 increment_string(op1); in increment_function()
1850 ZEND_API int decrement_function(zval *op1) /* {{{ */ in decrement_function() argument
1855 switch (Z_TYPE_P(op1)) { in decrement_function()
1857 if (Z_LVAL_P(op1) == LONG_MIN) { in decrement_function()
1858 double d = (double)Z_LVAL_P(op1); in decrement_function()
1859 ZVAL_DOUBLE(op1, d-1); in decrement_function()
1861 Z_LVAL_P(op1)--; in decrement_function()
1865 Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; in decrement_function()
1868 if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ in decrement_function()
1869 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1870 ZVAL_LONG(op1, -1); in decrement_function()
1873 switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { in decrement_function()
1875 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1878 ZVAL_DOUBLE(op1, d-1); in decrement_function()
1880 ZVAL_LONG(op1, lval-1); in decrement_function()
1884 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1885 ZVAL_DOUBLE(op1, dval - 1); in decrement_function()