[前][次][番号順一覧][スレッド一覧]

ruby-changes:43497

From: naruse <ko1@a...>
Date: Mon, 4 Jul 2016 13:09:59 +0900 (JST)
Subject: [ruby-changes:43497] naruse:r55569 (trunk): * random.c (random_ulong_limited): avoid left shift count >= width of

naruse	2016-07-04 13:09:51 +0900 (Mon, 04 Jul 2016)

  New Revision: 55569

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55569

  Log:
    * random.c (random_ulong_limited): avoid left shift count >= width of
      type on 32bit environment.

  Modified files:
    trunk/ChangeLog
    trunk/random.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55568)
+++ ChangeLog	(revision 55569)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jul  4 13:08:48 2016  NARUSE, Yui  <naruse@r...>
+
+	* random.c (random_ulong_limited): avoid left shift count >= width of
+	  type on 32bit environment.
+
 Sun Jul  3 18:51:42 2016  Martin Duerst  <duerst@i...>
 
 	* test/ruby/enc/test_case_comprehensive.rb, test_regex_casefold.rb,
Index: random.c
===================================================================
--- random.c	(revision 55568)
+++ random.c	(revision 55569)
@@ -992,9 +992,7 @@ random_ulong_limited(VALUE obj, rb_rando https://github.com/ruby/ruby/blob/trunk/random.c#L992
 	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 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]