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

ruby-changes:62100

From: Nobuyoshi <ko1@a...>
Date: Wed, 1 Jul 2020 22:44:43 +0900 (JST)
Subject: [ruby-changes:62100] 29ecce4d72 (master): Replaced f_odd_p with rb_int_odd_p

https://git.ruby-lang.org/ruby.git/commit/?id=29ecce4d72

From 29ecce4d72db6efc261ace8f951a922bf6b84166 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 30 May 2020 14:59:44 +0900
Subject: Replaced f_odd_p with rb_int_odd_p


diff --git a/rational.c b/rational.c
index 36e4296..cdd2bad 100644
--- a/rational.c
+++ b/rational.c
@@ -965,15 +965,6 @@ nurat_fdiv(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/rational.c#L965
     return rb_funcall(div, idTo_f, 0);
 }
 
-inline static VALUE
-f_odd_p(VALUE integer)
-{
-    if (rb_funcall(integer, '%', 1, INT2FIX(2)) != INT2FIX(0)) {
-	return Qtrue;
-    }
-    return Qfalse;
-}
-
 /*
  * call-seq:
  *    rat ** numeric  ->  numeric
@@ -1008,7 +999,7 @@ rb_rational_pow(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/rational.c#L999
 		return f_rational_new_bang1(CLASS_OF(self), ONE);
 	    }
 	    else if (f_minus_one_p(dat->num) && RB_INTEGER_TYPE_P(other)) {
-		return f_rational_new_bang1(CLASS_OF(self), INT2FIX(f_odd_p(other) ? -1 : 1));
+		return f_rational_new_bang1(CLASS_OF(self), INT2FIX(rb_int_odd_p(other) ? -1 : 1));
 	    }
 	    else if (INT_ZERO_P(dat->num)) {
 		if (rb_num_negative_p(other)) {
-- 
cgit v0.10.2


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

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