File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -1142,15 +1142,16 @@ ZEND_FUNCTION(gmp_pow)
11421142 RETURN_THROWS ();
11431143 }
11441144
1145- double powmax = log ((double )ZEND_LONG_MAX );
1146-
1147- INIT_GMP_RETVAL (gmpnum_result );
1148- zend_ulong gmpnum = mpz_get_ui (gmpnum_base );
1149- if ((log (gmpnum ) * exp ) > powmax ) {
1150- zend_value_error ("base and exponent overflow ");
1151- RETURN_THROWS ();
1145+ if (Z_TYPE_P (base_arg ) == IS_LONG && Z_LVAL_P (base_arg ) >= 0 ) {
1146+ INIT_GMP_RETVAL (gmpnum_result );
1147+ mpz_ui_pow_ui (gmpnum_result , Z_LVAL_P (base_arg ), exp );
1148+ } else {
1149+ mpz_ptr gmpnum_base ;
1150+ FETCH_GMP_ZVAL (gmpnum_base , base_arg , temp_base , 1 );
1151+ INIT_GMP_RETVAL (gmpnum_result );
1152+ mpz_pow_ui (gmpnum_result , gmpnum_base , exp );
1153+ FREE_GMP_TEMP (temp_base );
11521154 }
1153- mpz_pow_ui (gmpnum_result , gmpnum_base , exp );
11541155}
11551156/* }}} */
11561157
You can’t perform that action at this time.
0 commit comments