Skip to content

Commit

Permalink
#2370 - Remove zephir_mt_rand() and its optimizer
Browse files Browse the repository at this point in the history
Since PHP8.2 there were changes and optimizations in random extension.
  • Loading branch information
Jeckerson committed Sep 19, 2022
1 parent 42528b0 commit cc3a742
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 68 deletions.
53 changes: 0 additions & 53 deletions Library/Optimizers/FunctionCall/MtRandOptimizer.php

This file was deleted.

14 changes: 0 additions & 14 deletions kernels/ZendEngine3/math.c
Expand Up @@ -181,20 +181,6 @@ void zephir_round(zval *return_value, zval *op1, zval *op2, zval *op3)
}
}

zend_long zephir_mt_rand(zend_long min, zend_long max)
{
if (max < min) {
php_error_docref(NULL, E_WARNING, "max(" ZEND_LONG_FMT ") is smaller than min(" ZEND_LONG_FMT ")", max, min);
return 0;
}

if (!BG(mt_rand_is_seeded)) {
php_mt_srand(GENERATE_SEED());
}

return php_mt_rand_range(min, max);
}

double zephir_ldexp(zval *value, zval *expval)
{
int exp = (int) zephir_get_numberval(expval);
Expand Down
1 change: 0 additions & 1 deletion kernels/ZendEngine3/math.h
Expand Up @@ -23,7 +23,6 @@ double zephir_acos(zval *op1);
double zephir_sqrt(zval *op1);

double zephir_floor(zval *op1);
zend_long zephir_mt_rand(zend_long min, zend_long max);
double zephir_ceil(zval *op1);
void zephir_round(zval *return_value, zval *op1, zval *op2, zval *op3);

Expand Down

0 comments on commit cc3a742

Please sign in to comment.