Re: com php-src: Fix legacy mode RAND_RANGE and 32/64-bit consistency: ext/standard/mt_rand.c ext/standard/php_rand.h
| From: | Remi Collet | Date: | Wed, 03 Aug 2016 12:12:51 +0000 |
| Subject: | Re: com php-src: Fix legacy mode RAND_RANGE and 32/64-bit consistency: ext/standard/mt_rand.c ext/standard/php_rand.h | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-93562@lists.php.net to get a copy of this message | ||
Le 16/07/2016 à 18:50, Leigh a écrit :
> Commit: 027375d4c3a59b0f174b1beb70ba8f60efef6905
> Author: Leigh <leigh@php.net> Sat, 16 Jul 2016 16:50:20 +0000
> Parents: be3640150cb2f88d38a8d405b2bf708f04be39ef
> Branches: master
>
> Link:
> http://git.php.net/?p=php-src.git;a=commitdiff;h=027375d4c3a59b0f174b1beb70ba8f60efef6905
>
> Log:
> Fix legacy mode RAND_RANGE and 32/64-bit consistency
This breaks on 32bits, php hangs
(ext/standard/tests/math/mt_rand_variation2.phpt)
From trace, result grow and is stay > limit.
while (UNEXPECTED(result > limit)) {
printf("%lu > %lu\n", result, limit);
result = (result << 32) | php_mt_rand();
}
2705857063 > 2147495992
2717777703 > 2147495992
3053322047 > 2147495992
3221094335 > 2147495992
4294967295 > 2147495992
4294967295 > 2147495992
4294967295 > 2147495992
4294967295 > 2147495992
...
Can you please have a look, perhaps better to revert
(even if this keep a inconsistency between 32 and 64bits) ?
Remi.