[前][次][番号順一覧][スレッド一覧]

ruby-changes:29189

From: akr <ko1@a...>
Date: Wed, 12 Jun 2013 07:33:09 +0900 (JST)
Subject: [ruby-changes:29189] akr:r41241 (trunk): * random.c (rand_int): Use rb_big_uminus.

akr	2013-06-12 07:33:01 +0900 (Wed, 12 Jun 2013)

  New Revision: 41241

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41241

  Log:
    * random.c (rand_int): Use rb_big_uminus.

  Modified files:
    trunk/ChangeLog
    trunk/random.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41240)
+++ ChangeLog	(revision 41241)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 12 07:32:01 2013  Tanaka Akira  <akr@f...>
+
+	* random.c (rand_int): Use rb_big_uminus.
+
 Wed Jun 12 07:12:54 2013  Eric Hodel  <drbrain@s...>
 
 	* struct.c:  Improve documentation: replace "instance variable" with
Index: random.c
===================================================================
--- random.c	(revision 41240)
+++ random.c	(revision 41241)
@@ -946,8 +946,7 @@ rand_int(struct MT *mt, VALUE vmax, int https://github.com/ruby/ruby/blob/trunk/random.c#L946
 	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)) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]