From e39523b77b6d27a59950c741b46f0b7c8bb5539a Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 11 Jun 2013 22:33:01 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ random.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0eb53c843..18c0f8b7af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Jun 12 07:32:01 2013 Tanaka Akira + + * random.c (rand_int): Use rb_big_uminus. + Wed Jun 12 07:12:54 2013 Eric Hodel * struct.c: Improve documentation: replace "instance variable" with diff --git a/random.c b/random.c index 4175e94b44..61262fb4db 100644 --- a/random.c +++ b/random.c @@ -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)) {