com php-src: Merge branch 'PHP-5.6': ext/gmp/gmp.c ext/gmp/php _gmp.h
| From: | Stanislav Malyshev | Date: | Tue, 14 Oct 2014 07:43:15 +0000 |
| Subject: | com php-src: Merge branch 'PHP-5.6': ext/gmp/gmp.c ext/gmp/php _gmp.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82284@lists.php.net to get a copy of this message | ||
Commit: afdaedaa268197631e210772609fd1f7928f9973
Author: Stanislav Malyshev <stas@php.net> Tue, 14 Oct 2014 00:43:15 -0700
Parents: 2842766d7f677c54dcd0be390f292482d61ad4ae 4773c1dfdc10b2175422b4fda83a48e4792b90a1
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=afdaedaa268197631e210772609fd1f7928f9973
Log:
Merge branch 'PHP-5.6'
* PHP-5.6:
update NEWS and UPGRADING
Upated NEWS
Address issues raised by @nikic
Make sure min < max
Mersenne Twister was added in GMP 4.2
Add test files
Add gmp_random_bits(bits) and gmp_random_range(min, max)
Change GMPs default PRNG to Mersenne Twister
Conflicts:
ext/gmp/gmp.c
Changed paths:
MM ext/gmp/gmp.c
MM ext/gmp/php_gmp.h
Diff:
diff --cc ext/gmp/gmp.c
index b5c18ec,8aff2d6..de29404
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@@ -1743,6 -1795,22 +1754,18 @@@ ZEND_FUNCTION(gmp_sign
}
/* }}} */
+ static void gmp_init_random(TSRMLS_D)
+ {
+ if (!GMPG(rand_initialized)) {
+ /* Initialize */
-#if GMP_42_OR_NEWER
+ gmp_randinit_mt(GMPG(rand_state));
-#else
- gmp_randinit_lc_2exp(GMPG(rand_state), 32L);
-#endif
+ /* Seed */
+ gmp_randseed_ui(GMPG(rand_state), GENERATE_SEED());
+
+ GMPG(rand_initialized) = 1;
+ }
+ }
+
/* {{{ proto GMP gmp_random([int limiter])
Gets random number */
ZEND_FUNCTION(gmp_random)