com php-src: Swap min/max if min > max: ext/standard/mt_rand .c
| From: | Leigh | Date: | Mon, 08 Aug 2016 21:31:59 +0000 |
| Subject: | com php-src: Swap min/max if min > max: ext/standard/mt_rand .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93678@lists.php.net to get a copy of this message | ||
Commit: 2ece5decb7c37d780c1e7df71de27fcf78cda0de
Author: Leigh <leigh@php.net> Mon, 8 Aug 2016 22:31:59 +0100
Parents: 99e3bb14307a6fb0bf777f68408ab07351c0d6ed
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2ece5decb7c37d780c1e7df71de27fcf78cda0de
Log:
Swap min/max if min > max
Changed paths:
M ext/standard/mt_rand.c
Diff:
diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index c0b1d0a..f2866c5 100644
--- a/ext/standard/mt_rand.c
+++ b/ext/standard/mt_rand.c
@@ -276,6 +276,7 @@ PHP_FUNCTION(mt_rand)
if (UNEXPECTED(max < min)) {
php_error_docref(NULL, E_WARNING, "max(" ZEND_LONG_FMT ") is smaller than
min(" ZEND_LONG_FMT ")", max, min);
+ max ^= min ^= max ^= min;
}
if (BG(mt_rand_mode) == MT_RAND_MT19937) {