summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeigh <leigh@php.net>2016-08-08 22:31:59 +0100
committerLeigh <leigh@php.net>2016-08-08 22:31:59 +0100
commit2ece5decb7c37d780c1e7df71de27fcf78cda0de (patch)
tree704707398659667364c2fe52e322c41174456383
parent99e3bb14307a6fb0bf777f68408ab07351c0d6ed (diff)
downloadphp-git-2ece5decb7c37d780c1e7df71de27fcf78cda0de.tar.gz
Swap min/max if min > max
-rw-r--r--ext/standard/mt_rand.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index c0b1d0ac1a..f2866c5af2 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) {