diff options
author | S-H-GAMELINKS <gamelinks007@gmail.com> | 2021-09-03 20:50:12 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-11 09:13:24 +0900 |
commit | 032534dbdf08c0912dffa482e29a491b8aa9276c (patch) | |
tree | 0ef482a3c7d764610ae9e3a0c737fa3133032de7 /time.c | |
parent | 56065f0686e6798fff2ee7319f0f03026f427c13 (diff) |
Using RB_BIGNUM_TYPE_P macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4805
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -87,7 +87,7 @@ cmp(VALUE x, VALUE y) return 1; return 0; } - if (RB_TYPE_P(x, T_BIGNUM)) return FIX2INT(rb_big_cmp(x, y)); + if (RB_BIGNUM_TYPE_P(x)) return FIX2INT(rb_big_cmp(x, y)); return rb_cmpint(rb_funcall(x, idCmp, 1, y), x, y); } @@ -103,7 +103,7 @@ addv(VALUE x, VALUE y) if (FIXNUM_P(x) && FIXNUM_P(y)) { return LONG2NUM(FIX2LONG(x) + FIX2LONG(y)); } - if (RB_TYPE_P(x, T_BIGNUM)) return rb_big_plus(x, y); + if (RB_BIGNUM_TYPE_P(x)) return rb_big_plus(x, y); return rb_funcall(x, '+', 1, y); } @@ -113,7 +113,7 @@ subv(VALUE x, VALUE y) if (FIXNUM_P(x) && FIXNUM_P(y)) { return LONG2NUM(FIX2LONG(x) - FIX2LONG(y)); } - if (RB_TYPE_P(x, T_BIGNUM)) return rb_big_minus(x, y); + if (RB_BIGNUM_TYPE_P(x)) return rb_big_minus(x, y); return rb_funcall(x, '-', 1, y); } @@ -123,7 +123,7 @@ mulv(VALUE x, VALUE y) if (FIXNUM_P(x) && FIXNUM_P(y)) { return rb_fix_mul_fix(x, y); } - if (RB_TYPE_P(x, T_BIGNUM)) + if (RB_BIGNUM_TYPE_P(x)) return rb_big_mul(x, y); return rb_funcall(x, '*', 1, y); } @@ -134,7 +134,7 @@ divv(VALUE x, VALUE y) if (FIXNUM_P(x) && FIXNUM_P(y)) { return rb_fix_div_fix(x, y); } - if (RB_TYPE_P(x, T_BIGNUM)) + if (RB_BIGNUM_TYPE_P(x)) return rb_big_div(x, y); return rb_funcall(x, id_div, 1, y); } @@ -146,7 +146,7 @@ modv(VALUE x, VALUE y) if (FIX2LONG(y) == 0) rb_num_zerodiv(); if (FIXNUM_P(x)) return rb_fix_mod_fix(x, y); } - if (RB_TYPE_P(x, T_BIGNUM)) return rb_big_modulo(x, y); + if (RB_BIGNUM_TYPE_P(x)) return rb_big_modulo(x, y); return rb_funcall(x, '%', 1, y); } @@ -322,7 +322,7 @@ v2w(VALUE v) if (FIXNUM_P(v)) { return WIDEVAL_WRAP((WIDEVALUE)(SIGNED_WIDEVALUE)(long)v); } - else if (RB_TYPE_P(v, T_BIGNUM) && + else if (RB_BIGNUM_TYPE_P(v) && rb_absint_size(v, NULL) <= sizeof(WIDEVALUE)) { return v2w_bignum(v); } @@ -2575,7 +2575,7 @@ time_timespec(VALUE num, int interval) } } } - else if (RB_TYPE_P(num, T_BIGNUM)) { + else if (RB_BIGNUM_TYPE_P(num)) { t.tv_sec = NUM2TIMET(num); arg_range_check(t.tv_sec); t.tv_nsec = 0; |