@@ -1292,14 +1292,13 @@ static void ZEND_COLD zend_power_base_0_exponent_lt_0_error(void)
1292
1292
zend_error (E_DEPRECATED , "Power of base 0 and negative exponent is deprecated" );
1293
1293
}
1294
1294
1295
- static zend_result safe_pow (double * result , double base , double exponent )
1295
+ static double safe_pow (double base , double exponent )
1296
1296
{
1297
1297
if (UNEXPECTED (base == 0.0 && exponent < 0.0 )) {
1298
1298
zend_power_base_0_exponent_lt_0_error ();
1299
1299
}
1300
1300
1301
- * result = pow (base , exponent );
1302
- return SUCCESS ;
1301
+ return pow (base , exponent );
1303
1302
}
1304
1303
1305
1304
static zend_result ZEND_FASTCALL pow_function_base (zval * result , zval * op1 , zval * op2 ) /* {{{ */
@@ -1326,44 +1325,32 @@ static zend_result ZEND_FASTCALL pow_function_base(zval *result, zval *op1, zval
1326
1325
-- i ;
1327
1326
ZEND_SIGNED_MULTIPLY_LONG (l1 , l2 , l1 , dval , overflow );
1328
1327
if (overflow ) {
1329
- double pow_result ;
1330
- safe_pow (& pow_result , l2 , i );
1331
- ZVAL_DOUBLE (result , dval * pow_result );
1328
+ ZVAL_DOUBLE (result , dval * safe_pow (l2 , i ));
1332
1329
return SUCCESS ;
1333
1330
}
1334
1331
} else {
1335
1332
i /= 2 ;
1336
1333
ZEND_SIGNED_MULTIPLY_LONG (l2 , l2 , l2 , dval , overflow );
1337
1334
if (overflow ) {
1338
- double pow_result ;
1339
- safe_pow (& pow_result , dval , i );
1340
- ZVAL_DOUBLE (result , (double )l1 * pow_result );
1335
+ ZVAL_DOUBLE (result , (double )l1 * safe_pow (dval , i ));
1341
1336
return SUCCESS ;
1342
1337
}
1343
1338
}
1344
1339
}
1345
1340
/* i == 0 */
1346
1341
ZVAL_LONG (result , l1 );
1347
1342
} else {
1348
- double pow_result ;
1349
- safe_pow (& pow_result , (double )Z_LVAL_P (op1 ), (double )Z_LVAL_P (op2 ));
1350
- ZVAL_DOUBLE (result , pow_result );
1343
+ ZVAL_DOUBLE (result , safe_pow ((double )Z_LVAL_P (op1 ), (double )Z_LVAL_P (op2 )));
1351
1344
}
1352
1345
return SUCCESS ;
1353
1346
} else if (EXPECTED (type_pair == TYPE_PAIR (IS_DOUBLE , IS_DOUBLE ))) {
1354
- double pow_result ;
1355
- safe_pow (& pow_result , Z_DVAL_P (op1 ), Z_DVAL_P (op2 ));
1356
- ZVAL_DOUBLE (result , pow_result );
1347
+ ZVAL_DOUBLE (result , safe_pow (Z_DVAL_P (op1 ), Z_DVAL_P (op2 )));
1357
1348
return SUCCESS ;
1358
1349
} else if (EXPECTED (type_pair == TYPE_PAIR (IS_LONG , IS_DOUBLE ))) {
1359
- double pow_result ;
1360
- safe_pow (& pow_result , (double )Z_LVAL_P (op1 ), Z_DVAL_P (op2 ));
1361
- ZVAL_DOUBLE (result , pow_result );
1350
+ ZVAL_DOUBLE (result , safe_pow ((double )Z_LVAL_P (op1 ), Z_DVAL_P (op2 )));
1362
1351
return SUCCESS ;
1363
1352
} else if (EXPECTED (type_pair == TYPE_PAIR (IS_DOUBLE , IS_LONG ))) {
1364
- double pow_result ;
1365
- safe_pow (& pow_result , Z_DVAL_P (op1 ), (double )Z_LVAL_P (op2 ));
1366
- ZVAL_DOUBLE (result , pow_result );
1353
+ ZVAL_DOUBLE (result , safe_pow (Z_DVAL_P (op1 ), (double )Z_LVAL_P (op2 )));
1367
1354
return SUCCESS ;
1368
1355
} else {
1369
1356
return FAILURE ;
0 commit comments