Lines Matching refs:op1
758 ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in add_function() argument
764 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in add_function()
766 long lval = Z_LVAL_P(op1) + Z_LVAL_P(op2); in add_function()
769 if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK) in add_function()
770 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { in add_function()
772 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); in add_function()
780 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2)); in add_function()
784 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2))); in add_function()
788 ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2)); in add_function()
794 if ((result == op1) && (result == op2)) { in add_function()
798 if (result != op1) { in add_function()
799 *result = *op1; in add_function()
808 zendi_convert_scalar_to_number(op1, op1_copy, result); in add_function()
820 ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in sub_function() argument
826 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in sub_function()
828 long lval = Z_LVAL_P(op1) - Z_LVAL_P(op2); in sub_function()
831 if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK) in sub_function()
832 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (lval & LONG_SIGN_MASK)) { in sub_function()
834 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); in sub_function()
842 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2)); in sub_function()
846 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2))); in sub_function()
850 ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2)); in sub_function()
855 zendi_convert_scalar_to_number(op1, op1_copy, result); in sub_function()
867 ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in mul_function() argument
873 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in mul_function()
877 …ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); in mul_function()
883 ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2)); in mul_function()
887 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2))); in mul_function()
891 ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2)); in mul_function()
896 zendi_convert_scalar_to_number(op1, op1_copy, result); in mul_function()
908 ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in div_function() argument
914 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in div_function()
920 } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == LONG_MIN) { in div_function()
925 if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* integer */ in div_function()
926 ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2)); in div_function()
928 ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / Z_LVAL_P(op2)); in div_function()
938 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / (double)Z_LVAL_P(op2)); in div_function()
947 ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / Z_DVAL_P(op2)); in div_function()
956 ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2)); in div_function()
961 zendi_convert_scalar_to_number(op1, op1_copy, result); in div_function()
973 ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in mod_function() argument
978 zendi_convert_to_long(op1, op1_copy, result); in mod_function()
979 op1_lval = Z_LVAL_P(op1); in mod_function()
999 ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in boolean_xor_function() argument
1004 zendi_convert_to_boolean(op1, op1_copy, result); in boolean_xor_function()
1005 op1_lval = Z_LVAL_P(op1); in boolean_xor_function()
1012 ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ in boolean_not_function()
1016 zendi_convert_to_boolean(op1, op1_copy, result); in boolean_not_function()
1017 ZVAL_BOOL(result, !Z_LVAL_P(op1)); in boolean_not_function()
1022 ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */ in bitwise_not_function()
1024 zval op1_copy = *op1; in bitwise_not_function()
1026 op1 = &op1_copy; in bitwise_not_function()
1028 if (Z_TYPE_P(op1) == IS_LONG) { in bitwise_not_function()
1029 ZVAL_LONG(result, ~Z_LVAL_P(op1)); in bitwise_not_function()
1031 } else if (Z_TYPE_P(op1) == IS_DOUBLE) { in bitwise_not_function()
1032 ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1))); in bitwise_not_function()
1034 } else if (Z_TYPE_P(op1) == IS_STRING) { in bitwise_not_function()
1038 Z_STRVAL_P(result) = estrndup(Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in bitwise_not_function()
1039 Z_STRLEN_P(result) = Z_STRLEN_P(op1); in bitwise_not_function()
1040 for (i = 0; i < Z_STRLEN_P(op1); i++) { in bitwise_not_function()
1041 Z_STRVAL_P(result)[i] = ~Z_STRVAL_P(op1)[i]; in bitwise_not_function()
1050 ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_or_function() argument
1055 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_or_function()
1060 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_or_function()
1061 longer = op1; in bitwise_or_function()
1065 shorter = op1; in bitwise_or_function()
1074 if (result==op1) { in bitwise_or_function()
1081 zendi_convert_to_long(op1, op1_copy, result); in bitwise_or_function()
1082 op1_lval = Z_LVAL_P(op1); in bitwise_or_function()
1090 ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_and_function() argument
1095 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_and_function()
1100 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_and_function()
1101 longer = op1; in bitwise_and_function()
1105 shorter = op1; in bitwise_and_function()
1114 if (result==op1) { in bitwise_and_function()
1123 zendi_convert_to_long(op1, op1_copy, result); in bitwise_and_function()
1124 op1_lval = Z_LVAL_P(op1); in bitwise_and_function()
1132 ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in bitwise_xor_function() argument
1137 if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) { in bitwise_xor_function()
1142 if (Z_STRLEN_P(op1) >= Z_STRLEN_P(op2)) { in bitwise_xor_function()
1143 longer = op1; in bitwise_xor_function()
1147 shorter = op1; in bitwise_xor_function()
1156 if (result==op1) { in bitwise_xor_function()
1164 zendi_convert_to_long(op1, op1_copy, result); in bitwise_xor_function()
1165 op1_lval = Z_LVAL_P(op1); in bitwise_xor_function()
1173 ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in shift_left_function() argument
1178 zendi_convert_to_long(op1, op1_copy, result); in shift_left_function()
1179 op1_lval = Z_LVAL_P(op1); in shift_left_function()
1186 ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in shift_right_function() argument
1191 zendi_convert_to_long(op1, op1_copy, result); in shift_right_function()
1192 op1_lval = Z_LVAL_P(op1); in shift_right_function()
1200 ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ in add_char_to_string() argument
1202 Z_STRLEN_P(result) = Z_STRLEN_P(op1) + 1; in add_char_to_string()
1203 Z_STRVAL_P(result) = (char *) erealloc(Z_STRVAL_P(op1), Z_STRLEN_P(result)+1); in add_char_to_string()
1212 ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */ in add_string_to_string() argument
1214 int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in add_string_to_string()
1216 Z_STRVAL_P(result) = (char *) erealloc(Z_STRVAL_P(op1), length+1); in add_string_to_string()
1217 memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in add_string_to_string()
1225 ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in concat_function() argument
1230 if (Z_TYPE_P(op1) != IS_STRING) { in concat_function()
1231 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in concat_function()
1241 if (result == op1) { in concat_function()
1242 zval_dtor(op1); in concat_function()
1244 op1 = &op1_copy; in concat_function()
1249 if (result==op1) { /* special case, perform operations on result */ in concat_function()
1250 uint res_len = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in concat_function()
1252 if (Z_STRLEN_P(result) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) { in concat_function()
1264 Z_STRLEN_P(result) = Z_STRLEN_P(op1) + Z_STRLEN_P(op2); in concat_function()
1266 memcpy(Z_STRVAL_P(result), Z_STRVAL_P(op1), Z_STRLEN_P(op1)); in concat_function()
1267 memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2)); in concat_function()
1272 zval_dtor(op1); in concat_function()
1281 ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_compare_function() argument
1286 if (Z_TYPE_P(op1) != IS_STRING) { in string_compare_function()
1287 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in string_compare_function()
1294 op1 = &op1_copy; in string_compare_function()
1300 ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); in string_compare_function()
1303 zval_dtor(op1); in string_compare_function()
1313 ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in string_locale_compare_function() argument
1318 if (Z_TYPE_P(op1) != IS_STRING) { in string_locale_compare_function()
1319 zend_make_printable_zval(op1, &op1_copy, &use_copy1); in string_locale_compare_function()
1326 op1 = &op1_copy; in string_locale_compare_function()
1332 ZVAL_LONG(result, strcoll(Z_STRVAL_P(op1), Z_STRVAL_P(op2))); in string_locale_compare_function()
1335 zval_dtor(op1); in string_locale_compare_function()
1345 ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in numeric_compare_function() argument
1349 op1_copy = *op1; in numeric_compare_function()
1376 ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in compare_function() argument
1384 switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { in compare_function()
1386 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()
1390 Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2); in compare_function()
1395 Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2); in compare_function()
1400 Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2); in compare_function()
1405 zend_compare_arrays(result, op1, op2 TSRMLS_CC); in compare_function()
1417 ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); in compare_function()
1421 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1425 zendi_smart_strcmp(result, op1, op2); in compare_function()
1433 ZVAL_LONG(result, zend_binary_strcmp(Z_STRVAL_P(op1), Z_STRLEN_P(op1), "", 0)); in compare_function()
1446 if (Z_OBJ_HANDLER_P(op1,compare_objects) == Z_OBJ_HANDLER_P(op2,compare_objects)) { in compare_function()
1447 if (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)) { in compare_function()
1452 ZVAL_LONG(result, Z_OBJ_HT_P(op1)->compare_objects(op1, op2 TSRMLS_CC)); in compare_function()
1458 if (Z_TYPE_P(op1) == IS_OBJECT) { in compare_function()
1459 if (Z_OBJ_HT_P(op1)->get) { in compare_function()
1460 op_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC); in compare_function()
1464 } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) { in compare_function()
1466 if (Z_OBJ_HT_P(op1)->cast_object(op1, op_free, Z_TYPE_P(op2) TSRMLS_CC) == FAILURE) { in compare_function()
1479 ret = compare_function(result, op1, op_free TSRMLS_CC); in compare_function()
1482 } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) { in compare_function()
1484 if (Z_OBJ_HT_P(op2)->cast_object(op2, op_free, Z_TYPE_P(op1) TSRMLS_CC) == FAILURE) { in compare_function()
1489 ret = compare_function(result, op1, op_free TSRMLS_CC); in compare_function()
1492 } else if (Z_TYPE_P(op1) == IS_OBJECT) { in compare_function()
1498 if (Z_TYPE_P(op1) == IS_NULL) { in compare_function()
1503 zendi_convert_to_boolean(op1, op1_copy, result); in compare_function()
1504 ZVAL_LONG(result, Z_LVAL_P(op1) ? 1 : 0); in compare_function()
1506 } else if (Z_TYPE_P(op1) == IS_BOOL) { in compare_function()
1508 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1511 zendi_convert_to_boolean(op1, op1_copy, result); in compare_function()
1512 ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_LVAL_P(op1) - Z_LVAL_P(op2))); in compare_function()
1515 zendi_convert_scalar_to_number(op1, op1_copy, result); in compare_function()
1519 } else if (Z_TYPE_P(op1)==IS_ARRAY) { in compare_function()
1525 } else if (Z_TYPE_P(op1)==IS_OBJECT) { in compare_function()
1557 ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_identical_function() argument
1560 if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) { in is_identical_function()
1564 switch (Z_TYPE_P(op1)) { in is_identical_function()
1571 Z_LVAL_P(result) = (Z_LVAL_P(op1) == Z_LVAL_P(op2)); in is_identical_function()
1574 Z_LVAL_P(result) = (Z_DVAL_P(op1) == Z_DVAL_P(op2)); in is_identical_function()
1577 Z_LVAL_P(result) = ((Z_STRLEN_P(op1) == Z_STRLEN_P(op2)) in is_identical_function()
1578 && (!memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)))); in is_identical_function()
1581 Z_LVAL_P(result) = (Z_ARRVAL_P(op1) == Z_ARRVAL_P(op2) || in is_identical_function()
1582 …zend_hash_compare(Z_ARRVAL_P(op1), Z_ARRVAL_P(op2), (compare_func_t) hash_zval_identical_function,… in is_identical_function()
1585 if (Z_OBJ_HT_P(op1) == Z_OBJ_HT_P(op2)) { in is_identical_function()
1586 Z_LVAL_P(result) = (Z_OBJ_HANDLE_P(op1) == Z_OBJ_HANDLE_P(op2)); in is_identical_function()
1599 ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_not_identical_function() argument
1601 if (is_identical_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_not_identical_function()
1609 ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_equal_function() argument
1611 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_equal_function()
1619 ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_not_equal_function() argument
1621 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_not_equal_function()
1629 ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_smaller_function() argument
1631 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_smaller_function()
1639 ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ in is_smaller_or_equal_function() argument
1641 if (compare_function(result, op1, op2 TSRMLS_CC) == FAILURE) { in is_smaller_or_equal_function()
1758 ZEND_API int increment_function(zval *op1) /* {{{ */ in increment_function() argument
1760 switch (Z_TYPE_P(op1)) { in increment_function()
1762 if (Z_LVAL_P(op1) == LONG_MAX) { in increment_function()
1764 double d = (double)Z_LVAL_P(op1); in increment_function()
1765 ZVAL_DOUBLE(op1, d+1); in increment_function()
1767 Z_LVAL_P(op1)++; in increment_function()
1771 Z_DVAL_P(op1) = Z_DVAL_P(op1) + 1; in increment_function()
1774 ZVAL_LONG(op1, 1); in increment_function()
1780 switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { in increment_function()
1782 efree(Z_STRVAL_P(op1)); in increment_function()
1786 ZVAL_DOUBLE(op1, d+1); in increment_function()
1788 ZVAL_LONG(op1, lval+1); in increment_function()
1792 efree(Z_STRVAL_P(op1)); in increment_function()
1793 ZVAL_DOUBLE(op1, dval+1); in increment_function()
1797 increment_string(op1); in increment_function()
1809 ZEND_API int decrement_function(zval *op1) /* {{{ */ in decrement_function() argument
1814 switch (Z_TYPE_P(op1)) { in decrement_function()
1816 if (Z_LVAL_P(op1) == LONG_MIN) { in decrement_function()
1817 double d = (double)Z_LVAL_P(op1); in decrement_function()
1818 ZVAL_DOUBLE(op1, d-1); in decrement_function()
1820 Z_LVAL_P(op1)--; in decrement_function()
1824 Z_DVAL_P(op1) = Z_DVAL_P(op1) - 1; in decrement_function()
1827 if (Z_STRLEN_P(op1) == 0) { /* consider as 0 */ in decrement_function()
1828 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1829 ZVAL_LONG(op1, -1); in decrement_function()
1832 switch (is_numeric_string(Z_STRVAL_P(op1), Z_STRLEN_P(op1), &lval, &dval, 0)) { in decrement_function()
1834 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1837 ZVAL_DOUBLE(op1, d-1); in decrement_function()
1839 ZVAL_LONG(op1, lval-1); in decrement_function()
1843 STR_FREE(Z_STRVAL_P(op1)); in decrement_function()
1844 ZVAL_DOUBLE(op1, dval - 1); in decrement_function()