mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* random.c (rand_init): use the absolute value of seed to
make srand(-2**40) portable with 32bit and 64bit. [ruby-core:29292](2) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
309077c9ae
commit
19afeacb88
2 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Apr 13 00:12:04 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* 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@fsij.org>
|
||||
|
||||
* enumerator.c (inspect_enumerator): don't raise for uninitialized
|
||||
|
|
2
random.c
2
random.c
|
@ -376,6 +376,8 @@ rand_init(struct MT *mt, VALUE vseed)
|
|||
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) {
|
||||
|
|
Loading…
Reference in a new issue