Skip to content

Commit e1b1472

Browse files
committed
Micro optimization
1 parent a4d58bc commit e1b1472

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Zend/zend_operators.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,16 @@ static zend_never_inline zend_long ZEND_FASTCALL zendi_try_get_long(zval *op, bo
303303
return 0;
304304
case IS_TRUE:
305305
return 1;
306-
case IS_DOUBLE:
307-
if (!is_long_compatible(Z_DVAL_P(op))) {
308-
zend_error(E_DEPRECATED, "Implicit conversion to int from non-compatible float %f", Z_DVAL_P(op));
306+
case IS_DOUBLE: {
307+
double dval = Z_DVAL_P(op);
308+
if (!is_long_compatible(dval)) {
309+
zend_error(E_DEPRECATED, "Implicit conversion to int from non-compatible float %f", dval);
309310
if (UNEXPECTED(EG(exception))) {
310311
*failed = 1;
311312
}
312313
}
313-
return zend_dval_to_lval(Z_DVAL_P(op));
314+
return zend_dval_to_lval(dval);
315+
}
314316
case IS_STRING:
315317
{
316318
zend_uchar type;
@@ -820,15 +822,17 @@ ZEND_API zend_long ZEND_FASTCALL zval_get_long_func(zval *op, bool is_lax) /* {{
820822
return Z_RES_HANDLE_P(op);
821823
case IS_LONG:
822824
return Z_LVAL_P(op);
823-
case IS_DOUBLE:
825+
case IS_DOUBLE: {
826+
double dval = Z_DVAL_P(op);
824827
if (EXPECTED(!is_lax)) {
825-
if (!is_long_compatible(Z_DVAL_P(op))) {
826-
zend_error(E_DEPRECATED, "Implicit conversion to int from non-compatible float %f", Z_DVAL_P(op));
828+
if (!is_long_compatible(dval)) {
829+
zend_error(E_DEPRECATED, "Implicit conversion to int from non-compatible float %f", dval);
827830
// TODO Need to handle this here?
828831
//if (UNEXPECTED(EG(exception))) {}
829832
}
830833
}
831-
return zend_dval_to_lval(Z_DVAL_P(op));
834+
return zend_dval_to_lval(dval);
835+
}
832836
case IS_STRING:
833837
{
834838
zend_uchar type;

0 commit comments

Comments
 (0)