1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* random.c (rand_int): Use rb_big_uminus.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-06-11 22:33:01 +00:00
parent 28d975a633
commit e39523b77b
2 changed files with 5 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Wed Jun 12 07:32:01 2013 Tanaka Akira <akr@fsij.org>
* random.c (rand_int): Use rb_big_uminus.
Wed Jun 12 07:12:54 2013 Eric Hodel <drbrain@segment7.net>
* struct.c: Improve documentation: replace "instance variable" with

View file

@ -946,8 +946,7 @@ rand_int(struct MT *mt, VALUE vmax, int restrictive)
if (rb_bigzero_p(vmax)) return Qnil;
if (!RBIGNUM_SIGN(vmax)) {
if (restrictive) return Qnil;
vmax = rb_big_clone(vmax);
RBIGNUM_SET_SIGN(vmax, 1);
vmax = rb_big_uminus(vmax);
}
vmax = rb_big_minus(vmax, INT2FIX(1));
if (FIXNUM_P(vmax)) {