aboutsummaryrefslogtreecommitdiffstats
path: root/random.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-04 04:09:51 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-04 04:09:51 +0000
commit77a79eed4c5adff2563d6e783a6e2903a2a082eb (patch)
tree661923875c489ff68f0ba15866b583cf9e9d1289 /random.c
parent8fbde6d8301a2dd1aed45ad83489cfd48c8fcfc0 (diff)
downloadruby-77a79eed4c5adff2563d6e783a6e2903a2a082eb.tar.gz
* random.c (random_ulong_limited): avoid left shift count >= width of
type on 32bit environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/random.c b/random.c
index 4ffebf07f9..bc6474f864 100644
--- a/random.c
+++ b/random.c
@@ -992,9 +992,7 @@ random_ulong_limited(VALUE obj, rb_random_t *rnd, unsigned long limit)
const int n = w > 32 ? sizeof(unsigned long) : sizeof(uint32_t);
const unsigned long mask = ~(~0UL << w);
const unsigned long full =
-#if SIZEOF_LONG == 4
(size_t)n >= sizeof(unsigned long) ? ~0UL :
-#endif
~(~0UL << n * CHAR_BIT);
unsigned long val, bits = 0, rest = 0;
do {