aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-02-08 09:44:15 -0500
committerPeter Zhu <peter@peterzhu.ca>2024-02-12 15:07:47 -0500
commitfd87259a26df493d61923a202765fb21c13b7669 (patch)
treec4343d73274fa6185e3652ef27cfa55405a7076c /numeric.c
parent5644d90da0563fb5a9cdd6f5f3088f01b01ba06b (diff)
downloadruby-fd87259a26df493d61923a202765fb21c13b7669.tar.gz
Replace assert with RUBY_ASSERT in numeric.c
assert does not print the bug report, only the file and line number of the assertion that failed. RUBY_ASSERT prints the full bug report, which makes it much easier to debug.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/numeric.c b/numeric.c
index 52cee76014..6498aa4ea9 100644
--- a/numeric.c
+++ b/numeric.c
@@ -836,7 +836,7 @@ int_zero_p(VALUE num)
if (FIXNUM_P(num)) {
return FIXNUM_ZERO_P(num);
}
- assert(RB_BIGNUM_TYPE_P(num));
+ RUBY_ASSERT(RB_BIGNUM_TYPE_P(num));
return rb_bigzero_p(num);
}
@@ -3574,7 +3574,7 @@ rb_int_odd_p(VALUE num)
return RBOOL(num & 2);
}
else {
- assert(RB_BIGNUM_TYPE_P(num));
+ RUBY_ASSERT(RB_BIGNUM_TYPE_P(num));
return rb_big_odd_p(num);
}
}
@@ -3586,7 +3586,7 @@ int_even_p(VALUE num)
return RBOOL((num & 2) == 0);
}
else {
- assert(RB_BIGNUM_TYPE_P(num));
+ RUBY_ASSERT(RB_BIGNUM_TYPE_P(num));
return rb_big_even_p(num);
}
}
@@ -3843,7 +3843,7 @@ rb_int_uminus(VALUE num)
return fix_uminus(num);
}
else {
- assert(RB_BIGNUM_TYPE_P(num));
+ RUBY_ASSERT(RB_BIGNUM_TYPE_P(num));
return rb_big_uminus(num);
}
}
@@ -4359,7 +4359,7 @@ int_remainder(VALUE x, VALUE y)
if (FIXNUM_P(x)) {
if (FIXNUM_P(y)) {
VALUE z = fix_mod(x, y);
- assert(FIXNUM_P(z));
+ RUBY_ASSERT(FIXNUM_P(z));
if (z != INT2FIX(0) && (SIGNED_VALUE)(x ^ y) < 0)
z = fix_minus(z, y);
return z;
@@ -5444,7 +5444,7 @@ rb_fix_digits(VALUE fix, long base)
VALUE digits;
long x = FIX2LONG(fix);
- assert(x >= 0);
+ RUBY_ASSERT(x >= 0);
if (base < 2)
rb_raise(rb_eArgError, "invalid radix %ld", base);
@@ -5467,7 +5467,7 @@ rb_int_digits_bigbase(VALUE num, VALUE base)
{
VALUE digits, bases;
- assert(!rb_num_negative_p(num));
+ RUBY_ASSERT(!rb_num_negative_p(num));
if (RB_BIGNUM_TYPE_P(base))
base = rb_big_norm(base);