Lines Matching refs:op
142 #define convert_object_to_type(op, dst, ctype) \ argument
144 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), dst, ctype) == FAILURE) { \
146 "Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\
152 ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */ in convert_scalar_to_number() argument
155 switch (Z_TYPE_P(op)) { in convert_scalar_to_number()
157 zend_unwrap_reference(op); in convert_scalar_to_number()
163 str = Z_STR_P(op); in convert_scalar_to_number()
164 …if ((Z_TYPE_INFO_P(op)=is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &Z_LVAL_P(op), &Z_DVAL_P(op… in convert_scalar_to_number()
165 ZVAL_LONG(op, 0); in convert_scalar_to_number()
172 ZVAL_LONG(op, 0); in convert_scalar_to_number()
175 ZVAL_LONG(op, 1); in convert_scalar_to_number()
179 zend_long l = Z_RES_HANDLE_P(op); in convert_scalar_to_number()
180 zval_ptr_dtor(op); in convert_scalar_to_number()
181 ZVAL_LONG(op, l); in convert_scalar_to_number()
188 convert_object_to_type(op, &dst, _IS_NUMBER); in convert_scalar_to_number()
189 zval_ptr_dtor(op); in convert_scalar_to_number()
192 ZVAL_COPY_VALUE(op, &dst); in convert_scalar_to_number()
194 ZVAL_LONG(op, 1); in convert_scalar_to_number()
202 static zend_never_inline zval* ZEND_FASTCALL _zendi_convert_scalar_to_number_silent(zval *op, zval … in _zendi_convert_scalar_to_number_silent() argument
204 switch (Z_TYPE_P(op)) { in _zendi_convert_scalar_to_number_silent()
213 …if ((Z_TYPE_INFO_P(holder) = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL_P(holder), … in _zendi_convert_scalar_to_number_silent()
218 ZVAL_LONG(holder, Z_RES_HANDLE_P(op)); in _zendi_convert_scalar_to_number_silent()
221 convert_object_to_type(op, holder, _IS_NUMBER); in _zendi_convert_scalar_to_number_silent()
230 return op; in _zendi_convert_scalar_to_number_silent()
235 static zend_never_inline zend_result ZEND_FASTCALL _zendi_try_convert_scalar_to_number(zval *op, zv… in _zendi_try_convert_scalar_to_number() argument
237 switch (Z_TYPE_P(op)) { in _zendi_try_convert_scalar_to_number()
249 if (0 == (Z_TYPE_INFO_P(holder) = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), in _zendi_try_convert_scalar_to_number()
263 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), holder, _IS_NUMBER) == FAILURE in _zendi_try_convert_scalar_to_number()
277 static zend_always_inline zend_result zendi_try_convert_scalar_to_number(zval *op, zval *holder) /*… in zendi_try_convert_scalar_to_number() argument
279 if (Z_TYPE_P(op) == IS_LONG || Z_TYPE_P(op) == IS_DOUBLE) { in zendi_try_convert_scalar_to_number()
280 ZVAL_COPY_VALUE(holder, op); in zendi_try_convert_scalar_to_number()
283 return _zendi_try_convert_scalar_to_number(op, holder); in zendi_try_convert_scalar_to_number()
288 static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, zend_bool *failed) /*… in zendi_try_get_long() argument
291 switch (Z_TYPE_P(op)) { in zendi_try_get_long()
298 return zend_dval_to_lval(Z_DVAL_P(op)); in zendi_try_get_long()
307 type = is_numeric_string_ex(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, in zendi_try_get_long()
333 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &dst, IS_LONG) == FAILURE in zendi_try_get_long()
425 ZEND_API void ZEND_FASTCALL convert_to_long(zval *op) /* {{{ */ in convert_to_long() argument
427 if (Z_TYPE_P(op) != IS_LONG) { in convert_to_long()
428 convert_to_long_base(op, 10); in convert_to_long()
433 ZEND_API void ZEND_FASTCALL convert_to_long_base(zval *op, int base) /* {{{ */ in convert_to_long_base() argument
438 switch (Z_TYPE_P(op)) { in convert_to_long_base()
441 ZVAL_LONG(op, 0); in convert_to_long_base()
444 ZVAL_LONG(op, 1); in convert_to_long_base()
447 tmp = Z_RES_HANDLE_P(op); in convert_to_long_base()
448 zval_ptr_dtor(op); in convert_to_long_base()
449 ZVAL_LONG(op, tmp); in convert_to_long_base()
454 ZVAL_LONG(op, zend_dval_to_lval(Z_DVAL_P(op))); in convert_to_long_base()
458 zend_string *str = Z_STR_P(op); in convert_to_long_base()
460 ZVAL_LONG(op, zval_get_long(op)); in convert_to_long_base()
462 ZVAL_LONG(op, ZEND_STRTOL(ZSTR_VAL(str), NULL, base)); in convert_to_long_base()
468 tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); in convert_to_long_base()
469 zval_ptr_dtor(op); in convert_to_long_base()
470 ZVAL_LONG(op, tmp); in convert_to_long_base()
476 convert_object_to_type(op, &dst, IS_LONG); in convert_to_long_base()
477 zval_ptr_dtor(op); in convert_to_long_base()
480 ZVAL_LONG(op, Z_LVAL(dst)); in convert_to_long_base()
482 ZVAL_LONG(op, 1); in convert_to_long_base()
487 zend_unwrap_reference(op); in convert_to_long_base()
494 ZEND_API void ZEND_FASTCALL convert_to_double(zval *op) /* {{{ */ in convert_to_double() argument
499 switch (Z_TYPE_P(op)) { in convert_to_double()
502 ZVAL_DOUBLE(op, 0.0); in convert_to_double()
505 ZVAL_DOUBLE(op, 1.0); in convert_to_double()
508 double d = (double) Z_RES_HANDLE_P(op); in convert_to_double()
509 zval_ptr_dtor(op); in convert_to_double()
510 ZVAL_DOUBLE(op, d); in convert_to_double()
514 ZVAL_DOUBLE(op, (double) Z_LVAL_P(op)); in convert_to_double()
520 zend_string *str = Z_STR_P(op); in convert_to_double()
522 ZVAL_DOUBLE(op, zend_strtod(ZSTR_VAL(str), NULL)); in convert_to_double()
527 tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); in convert_to_double()
528 zval_ptr_dtor(op); in convert_to_double()
529 ZVAL_DOUBLE(op, tmp); in convert_to_double()
535 convert_object_to_type(op, &dst, IS_DOUBLE); in convert_to_double()
536 zval_ptr_dtor(op); in convert_to_double()
539 ZVAL_DOUBLE(op, Z_DVAL(dst)); in convert_to_double()
541 ZVAL_DOUBLE(op, 1.0); in convert_to_double()
546 zend_unwrap_reference(op); in convert_to_double()
553 ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */ in convert_to_null() argument
555 zval_ptr_dtor(op); in convert_to_null()
556 ZVAL_NULL(op); in convert_to_null()
560 ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */ in convert_to_boolean() argument
565 switch (Z_TYPE_P(op)) { in convert_to_boolean()
570 ZVAL_FALSE(op); in convert_to_boolean()
573 zend_long l = (Z_RES_HANDLE_P(op) ? 1 : 0); in convert_to_boolean()
575 zval_ptr_dtor(op); in convert_to_boolean()
576 ZVAL_BOOL(op, l); in convert_to_boolean()
580 ZVAL_BOOL(op, Z_LVAL_P(op) ? 1 : 0); in convert_to_boolean()
583 ZVAL_BOOL(op, Z_DVAL_P(op) ? 1 : 0); in convert_to_boolean()
587 zend_string *str = Z_STR_P(op); in convert_to_boolean()
591 ZVAL_FALSE(op); in convert_to_boolean()
593 ZVAL_TRUE(op); in convert_to_boolean()
599 tmp = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); in convert_to_boolean()
600 zval_ptr_dtor(op); in convert_to_boolean()
601 ZVAL_BOOL(op, tmp); in convert_to_boolean()
607 convert_object_to_type(op, &dst, _IS_BOOL); in convert_to_boolean()
608 zval_ptr_dtor(op); in convert_to_boolean()
611 Z_TYPE_INFO_P(op) = Z_TYPE_INFO(dst); in convert_to_boolean()
613 ZVAL_TRUE(op); in convert_to_boolean()
618 zend_unwrap_reference(op); in convert_to_boolean()
625 ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */ in _convert_to_string() argument
628 switch (Z_TYPE_P(op)) { in _convert_to_string()
632 ZVAL_EMPTY_STRING(op); in _convert_to_string()
636 ZVAL_CHAR(op, '1'); in _convert_to_string()
641 …end_string *str = zend_strpprintf(0, "Resource id #" ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op)); in _convert_to_string()
642 zval_ptr_dtor(op); in _convert_to_string()
643 ZVAL_NEW_STR(op, str); in _convert_to_string()
647 ZVAL_STR(op, zend_long_to_str(Z_LVAL_P(op))); in _convert_to_string()
652 double dval = Z_DVAL_P(op); in _convert_to_string()
656 ZVAL_NEW_STR(op, str); in _convert_to_string()
661 zval_ptr_dtor(op); in _convert_to_string()
662 ZVAL_INTERNED_STR(op, ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED)); in _convert_to_string()
666 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) { in _convert_to_string()
667 zval_ptr_dtor(op); in _convert_to_string()
668 ZVAL_COPY_VALUE(op, &tmp); in _convert_to_string()
672 …_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); in _convert_to_string()
674 zval_ptr_dtor(op); in _convert_to_string()
675 ZVAL_EMPTY_STRING(op); in _convert_to_string()
679 zend_unwrap_reference(op); in _convert_to_string()
686 ZEND_API zend_bool ZEND_FASTCALL _try_convert_to_string(zval *op) /* {{{ */ in _try_convert_to_string() argument
690 ZEND_ASSERT(Z_TYPE_P(op) != IS_STRING); in _try_convert_to_string()
691 str = zval_try_get_string_func(op); in _try_convert_to_string()
695 zval_ptr_dtor(op); in _try_convert_to_string()
696 ZVAL_STR(op, str); in _try_convert_to_string()
701 static void convert_scalar_to_array(zval *op) /* {{{ */ in convert_scalar_to_array() argument
704 zend_hash_index_add_new(ht, 0, op); in convert_scalar_to_array()
705 ZVAL_ARR(op, ht); in convert_scalar_to_array()
709 ZEND_API void ZEND_FASTCALL convert_to_array(zval *op) /* {{{ */ in convert_to_array() argument
712 switch (Z_TYPE_P(op)) { in convert_to_array()
717 if (Z_OBJCE_P(op) == zend_ce_closure) { in convert_to_array()
718 convert_scalar_to_array(op); in convert_to_array()
720 HashTable *obj_ht = zend_get_properties_for(op, ZEND_PROP_PURPOSE_ARRAY_CAST); in convert_to_array()
723 (Z_OBJCE_P(op)->default_properties_count || in convert_to_array()
724 Z_OBJ_P(op)->handlers != &std_object_handlers || in convert_to_array()
726 zval_ptr_dtor(op); in convert_to_array()
727 ZVAL_ARR(op, new_obj_ht); in convert_to_array()
730 zval_ptr_dtor(op); in convert_to_array()
732 array_init(op); in convert_to_array()
738 array_init(op); in convert_to_array()
741 zend_unwrap_reference(op); in convert_to_array()
744 convert_scalar_to_array(op); in convert_to_array()
750 ZEND_API void ZEND_FASTCALL convert_to_object(zval *op) /* {{{ */ in convert_to_object() argument
753 switch (Z_TYPE_P(op)) { in convert_to_object()
756 HashTable *ht = zend_symtable_to_proptable(Z_ARR_P(op)); in convert_to_object()
762 } else if (ht != Z_ARR_P(op)) { in convert_to_object()
763 zval_ptr_dtor(op); in convert_to_object()
769 ZVAL_OBJ(op, obj); in convert_to_object()
775 object_init(op); in convert_to_object()
778 zend_unwrap_reference(op); in convert_to_object()
782 ZVAL_COPY_VALUE(&tmp, op); in convert_to_object()
783 object_init(op); in convert_to_object()
784 zend_hash_add_new(Z_OBJPROP_P(op), ZSTR_KNOWN(ZEND_STR_SCALAR), &tmp); in convert_to_object()
791 ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op) /* {{{ */ in zval_get_long_func() argument
794 switch (Z_TYPE_P(op)) { in zval_get_long_func()
802 return Z_RES_HANDLE_P(op); in zval_get_long_func()
804 return Z_LVAL_P(op); in zval_get_long_func()
806 return zend_dval_to_lval(Z_DVAL_P(op)); in zval_get_long_func()
812 if (0 == (type = is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &lval, &dval, true))) { in zval_get_long_func()
826 return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1 : 0; in zval_get_long_func()
830 convert_object_to_type(op, &dst, IS_LONG); in zval_get_long_func()
838 op = Z_REFVAL_P(op); in zval_get_long_func()
846 ZEND_API double ZEND_FASTCALL zval_get_double_func(zval *op) /* {{{ */ in zval_get_double_func() argument
849 switch (Z_TYPE_P(op)) { in zval_get_double_func()
856 return (double) Z_RES_HANDLE_P(op); in zval_get_double_func()
858 return (double) Z_LVAL_P(op); in zval_get_double_func()
860 return Z_DVAL_P(op); in zval_get_double_func()
862 return zend_strtod(Z_STRVAL_P(op), NULL); in zval_get_double_func()
864 return zend_hash_num_elements(Z_ARRVAL_P(op)) ? 1.0 : 0.0; in zval_get_double_func()
868 convert_object_to_type(op, &dst, IS_DOUBLE); in zval_get_double_func()
877 op = Z_REFVAL_P(op); in zval_get_double_func()
885 static zend_always_inline zend_string* __zval_get_string_func(zval *op, zend_bool try) /* {{{ */ in __zval_get_string_func() argument
888 switch (Z_TYPE_P(op)) { in __zval_get_string_func()
896 return zend_strpprintf(0, "Resource id #" ZEND_LONG_FMT, (zend_long)Z_RES_HANDLE_P(op)); in __zval_get_string_func()
899 return zend_long_to_str(Z_LVAL_P(op)); in __zval_get_string_func()
902 return zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op)); in __zval_get_string_func()
910 if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) { in __zval_get_string_func()
914 …_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); in __zval_get_string_func()
919 op = Z_REFVAL_P(op); in __zval_get_string_func()
922 return zend_string_copy(Z_STR_P(op)); in __zval_get_string_func()
929 ZEND_API zend_string* ZEND_FASTCALL zval_get_string_func(zval *op) /* {{{ */ in zval_get_string_func() argument
931 return __zval_get_string_func(op, 0); in zval_get_string_func()
935 ZEND_API zend_string* ZEND_FASTCALL zval_try_get_string_func(zval *op) /* {{{ */ in zval_try_get_string_func() argument
937 return __zval_get_string_func(op, 1); in zval_try_get_string_func()
2539 ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */ in zend_is_true() argument
2541 return (int) i_zend_is_true(op); in zend_is_true()
2545 ZEND_API bool ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ in zend_object_is_true() argument
2547 zend_object *zobj = Z_OBJ_P(op); in zend_object_is_true()
2575 __m128i op = _mm_loadu_si128((__m128i*)p); in zend_str_tolower_impl() local
2576 __m128i gt = _mm_cmpgt_epi8(op, _A); in zend_str_tolower_impl()
2577 __m128i lt = _mm_cmplt_epi8(op, Z_); in zend_str_tolower_impl()
2580 __m128i lower = _mm_add_epi8(op, add); in zend_str_tolower_impl()
2647 __m128i op = _mm_loadu_si128((__m128i*)p); in zend_string_tolower_ex() local
2648 __m128i gt = _mm_cmpgt_epi8(op, _A); in zend_string_tolower_ex()
2649 __m128i lt = _mm_cmplt_epi8(op, Z_); in zend_string_tolower_ex()
2659 __m128i lower = _mm_add_epi8(op, add); in zend_string_tolower_ex()
2964 ZEND_API void ZEND_FASTCALL zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC) /* {{{ */
2968 str = zend_strpprintf(0, "%.*G", (int) EG(precision), (double)Z_DVAL_P(op));
2969 ZVAL_NEW_STR(op, str);