ruby-changes:15428
From: akr <ko1@a...>
Date: Tue, 13 Apr 2010 00:17:07 +0900 (JST)
Subject: [ruby-changes:15428] Ruby:r27323 (trunk): * random.c (rand_init): use the absolute value of seed to
akr 2010-04-13 00:16:45 +0900 (Tue, 13 Apr 2010) New Revision: 27323 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27323 Log: * random.c (rand_init): use the absolute value of seed to make srand(-2**40) portable with 32bit and 64bit. [ruby-core:29292](2) Modified files: trunk/ChangeLog trunk/random.c Index: ChangeLog =================================================================== --- ChangeLog (revision 27322) +++ ChangeLog (revision 27323) @@ -1,3 +1,9 @@ +Tue Apr 13 00:12:04 2010 Tanaka Akira <akr@f...> + + * random.c (rand_init): use the absolute value of seed to + make srand(-2**40) portable with 32bit and 64bit. + [ruby-core:29292](2) + Mon Apr 12 22:48:47 2010 Tanaka Akira <akr@f...> * enumerator.c (inspect_enumerator): don't raise for uninitialized Index: random.c =================================================================== --- random.c (revision 27322) +++ random.c (revision 27323) @@ -376,6 +376,8 @@ case T_FIXNUM: len = 1; fixnum_seed = FIX2LONG(seed); + if (fixnum_seed < 0) + fixnum_seed = -fixnum_seed; buf[0] = (unsigned int)(fixnum_seed & 0xffffffff); #if SIZEOF_LONG > SIZEOF_INT32 if ((long)(int)fixnum_seed != fixnum_seed) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/