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

ruby-changes:29122

From: charliesome <ko1@a...>
Date: Sat, 8 Jun 2013 19:33:20 +0900 (JST)
Subject: [ruby-changes:29122] charliesome:r41174 (trunk): * random.c (limited_big_rand): declare rnd, lim and mask as uint32_t

charliesome	2013-06-08 19:33:05 +0900 (Sat, 08 Jun 2013)

  New Revision: 41174

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41174

  Log:
    * random.c (limited_big_rand): declare rnd, lim and mask as uint32_t
      to avoid 64 bit to 32 bit shorten warnings.

  Modified files:
    trunk/ChangeLog
    trunk/random.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41173)
+++ ChangeLog	(revision 41174)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jun  8 19:31:00 2013  Charlie Somerville  <charliesome@r...>
+
+	* random.c (limited_big_rand): declare rnd, lim and mask as uint32_t
+	  to avoid 64 bit to 32 bit shorten warnings.
+
 Sat Jun  8 19:23:53 2013  NARUSE, Yui  <naruse@r...>
 
 	* win32/Makefile.sub: r41163 changed win32/win32.c and configure.in
Index: random.c
===================================================================
--- random.c	(revision 41173)
+++ random.c	(revision 41174)
@@ -741,7 +741,7 @@ limited_big_rand(struct MT *mt, VALUE li https://github.com/ruby/ruby/blob/trunk/random.c#L741
 {
     /* mt must be initialized */
 
-    unsigned long mask, lim, rnd;
+    uint32_t mask;
     long i;
     int boundary;
 
@@ -761,8 +761,9 @@ limited_big_rand(struct MT *mt, VALUE li https://github.com/ruby/ruby/blob/trunk/random.c#L761
     mask = 0;
     boundary = 1;
     for (i = len-1; 0 <= i; i--) {
-        lim = lim_array[i];
-        mask = mask ? 0xffffffff : make_mask(lim);
+	uint32_t rnd;
+        uint32_t lim = lim_array[i];
+        mask = mask ? 0xffffffff : (uint32_t)make_mask(lim);
         if (mask) {
             rnd = genrand_int32(mt) & mask;
             if (boundary) {

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

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