diff options
author | S.H <[email protected]> | 2020-06-17 02:13:54 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-16 10:13:54 -0700 |
commit | eaf76be08720fe11e7faf5c3011d9fe58fe3cec4 (patch) | |
tree | a2d779f7d1a990ca1fb29c3c3a33f2ab18ed0fc4 /numeric.c | |
parent | b877928ca562ce1769d821769d3e417ed973b156 (diff) |
Remove unused else if statements in int_even_p func (#3220)
* remove else if & rb_funcall
* fix int_even_p impl
* fix rb_int_odd_p implementation
Notes
Notes:
Merged-By: k0kubun <[email protected]>
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -3252,14 +3252,12 @@ rb_int_odd_p(VALUE num) if (num & 2) { return Qtrue; } + return Qfalse; } - else if (RB_TYPE_P(num, T_BIGNUM)) { + else { + assert(RB_TYPE_P(num, T_BIGNUM)); return rb_big_odd_p(num); } - else if (rb_funcall(num, '%', 1, INT2FIX(2)) != INT2FIX(0)) { - return Qtrue; - } - return Qfalse; } /* @@ -3276,14 +3274,12 @@ int_even_p(VALUE num) if ((num & 2) == 0) { return Qtrue; } + return Qfalse; } - else if (RB_TYPE_P(num, T_BIGNUM)) { + else { + assert(RB_TYPE_P(num, T_BIGNUM)); return rb_big_even_p(num); } - else if (rb_funcall(num, '%', 1, INT2FIX(2)) == INT2FIX(0)) { - return Qtrue; - } - return Qfalse; } /* |