summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-11 22:33:01 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-11 22:33:01 +0000
commite39523b77b6d27a59950c741b46f0b7c8bb5539a (patch)
tree3cdd997b26ed586698f7f0fe3ab78a16233511b8 /random.c
parent28d975a6330c6111a99f5f7530f0a56709a98a50 (diff)
downloadruby-e39523b77b6d27a59950c741b46f0b7c8bb5539a.tar.gz
* 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
Diffstat (limited to 'random.c')
-rw-r--r--random.c3
1 files changed, 1 insertions, 2 deletions
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)) {