summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authorS.H <gamelinks007@gmail.com>2021-08-18 02:25:19 +0900
committerGitHub <noreply@github.com>2021-08-18 02:25:19 +0900
commit58bd9434360d5a46974eaa03139893c0145615dc (patch)
tree9ed044f8c37e0dfbdf54d0f784b85031bce57dd6 /rational.c
parent6a9bfa4d9387b9d8f07f43f4546437be57f9e27c (diff)
downloadruby-58bd9434360d5a46974eaa03139893c0145615dc.tar.gz
Replace f_boolcast with RBOOL macro
* Move f_boolcast definination * Remove f_boolcast macro defination * to
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/rational.c b/rational.c
index 7324f78621..88693d94c4 100644
--- a/rational.c
+++ b/rational.c
@@ -46,7 +46,6 @@ static ID id_abs, id_integer_p,
#define id_idiv idDiv
#define id_to_i idTo_i
-#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
#define f_inspect rb_inspect
#define f_to_s rb_obj_as_string
@@ -1136,12 +1135,12 @@ nurat_eqeq_p(VALUE self, VALUE other)
}
else {
const double d = nurat_to_double(self);
- return f_boolcast(FIXNUM_ZERO_P(rb_dbl_cmp(d, NUM2DBL(other))));
+ return RBOOL(FIXNUM_ZERO_P(rb_dbl_cmp(d, NUM2DBL(other))));
}
}
else if (RB_FLOAT_TYPE_P(other)) {
const double d = nurat_to_double(self);
- return f_boolcast(FIXNUM_ZERO_P(rb_dbl_cmp(d, RFLOAT_VALUE(other))));
+ return RBOOL(FIXNUM_ZERO_P(rb_dbl_cmp(d, RFLOAT_VALUE(other))));
}
else if (RB_TYPE_P(other, T_RATIONAL)) {
{
@@ -1150,7 +1149,7 @@ nurat_eqeq_p(VALUE self, VALUE other)
if (INT_ZERO_P(adat->num) && INT_ZERO_P(bdat->num))
return Qtrue;
- return f_boolcast(rb_int_equal(adat->num, bdat->num) &&
+ return RBOOL(rb_int_equal(adat->num, bdat->num) &&
rb_int_equal(adat->den, bdat->den));
}
}
@@ -1201,7 +1200,7 @@ static VALUE
nurat_positive_p(VALUE self)
{
get_dat1(self);
- return f_boolcast(INT_POSITIVE_P(dat->num));
+ return RBOOL(INT_POSITIVE_P(dat->num));
}
/*
@@ -1214,7 +1213,7 @@ static VALUE
nurat_negative_p(VALUE self)
{
get_dat1(self);
- return f_boolcast(INT_NEGATIVE_P(dat->num));
+ return RBOOL(INT_NEGATIVE_P(dat->num));
}
/*