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

ruby-changes:42891

From: nobu <ko1@a...>
Date: Tue, 10 May 2016 00:29:16 +0900 (JST)
Subject: [ruby-changes:42891] nobu:r54965 (trunk): random.c: compare by rb_equal

nobu	2016-05-10 01:25:53 +0900 (Tue, 10 May 2016)

  New Revision: 54965

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54965

  Log:
    random.c: compare by rb_equal
    
    * random.c (random_equal): compare seeds by rb_equal.

  Modified files:
    trunk/random.c
Index: random.c
===================================================================
--- random.c	(revision 54964)
+++ random.c	(revision 54965)
@@ -1346,11 +1346,10 @@ random_equal(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/random.c#L1346
     if (rb_obj_class(self) != rb_obj_class(other)) return Qfalse;
     r1 = get_rnd(self);
     r2 = get_rnd(other);
-    if (!RTEST(rb_funcall2(r1->seed, rb_intern("=="), 1, &r2->seed))) return Qfalse;
     if (memcmp(r1->mt.state, r2->mt.state, sizeof(r1->mt.state))) return Qfalse;
     if ((r1->mt.next - r1->mt.state) != (r2->mt.next - r2->mt.state)) return Qfalse;
     if (r1->mt.left != r2->mt.left) return Qfalse;
-    return Qtrue;
+    return rb_equal(r1->seed, r2->seed);
 }
 
 /*

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

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