summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-01 16:06:07 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-01 17:01:40 +0900
commit77ee47188efc64fe8b508494e9b11e8ed481d33c (patch)
treee815f0767f55bc6d64f3d396318becc21f800e02
parent243320d22fcd0b9b7ee4cc5b1b420dcd63d87f5f (diff)
Make the internal predict `int_zero_p` return a bool
-rw-r--r--numeric.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/numeric.c b/numeric.c
index 1de11d1284..9d5695de23 100644
--- a/numeric.c
+++ b/numeric.c
@@ -825,20 +825,20 @@ num_zero_p(VALUE num)
return rb_equal(num, INT2FIX(0));
}
-static VALUE
+static bool
int_zero_p(VALUE num)
{
if (FIXNUM_P(num)) {
- return RBOOL(FIXNUM_ZERO_P(num));
+ return FIXNUM_ZERO_P(num);
}
assert(RB_BIGNUM_TYPE_P(num));
- return RBOOL(rb_bigzero_p(num));
+ return rb_bigzero_p(num);
}
VALUE
rb_int_zero_p(VALUE num)
{
- return int_zero_p(num);
+ return RBOOL(int_zero_p(num));
}
/*
@@ -3687,7 +3687,7 @@ static VALUE
int_nobits_p(VALUE num, VALUE mask)
{
mask = rb_to_int(mask);
- return int_zero_p(rb_int_and(num, mask));
+ return RBOOL(int_zero_p(rb_int_and(num, mask)));
}
/*
@@ -5238,7 +5238,7 @@ int_aref1(VALUE num, VALUE arg)
if (!RTEST(num_negative_p(end))) {
if (!excl) end = rb_int_plus(end, INT2FIX(1));
VALUE mask = generate_mask(end);
- if (RTEST(int_zero_p(rb_int_and(num, mask)))) {
+ if (int_zero_p(rb_int_and(num, mask))) {
return INT2FIX(0);
}
else {