summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/random.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/random.c b/ext/standard/random.c
index 12c25031d8..4a1adbfb02 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -182,7 +182,7 @@ PHP_FUNCTION(random_int)
umax++;
/* Powers of two are not biased */
- if ((umax & ~umax) != umax) {
+ if ((umax & (umax - 1)) != 0) {
/* Ceiling under which ZEND_LONG_MAX % max == 0 */
zend_ulong limit = ZEND_ULONG_MAX - (ZEND_ULONG_MAX % umax) - 1;