mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
complex.c: replace misused UNLIKELY with LIKELY
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e87935958
commit
bbd1e83e5a
1 changed files with 8 additions and 8 deletions
16
complex.c
16
complex.c
|
@ -72,7 +72,7 @@ inline static VALUE
|
|||
f_add(VALUE x, VALUE y)
|
||||
{
|
||||
if (RB_INTEGER_TYPE_P(x) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(rb_cInteger, idPLUS))) {
|
||||
LIKELY(rb_method_basic_definition_p(rb_cInteger, idPLUS))) {
|
||||
if (FIXNUM_ZERO_P(x))
|
||||
return y;
|
||||
if (FIXNUM_ZERO_P(y))
|
||||
|
@ -80,13 +80,13 @@ f_add(VALUE x, VALUE y)
|
|||
return rb_int_plus(x, y);
|
||||
}
|
||||
else if (RB_FLOAT_TYPE_P(x) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(rb_cFloat, idPLUS))) {
|
||||
LIKELY(rb_method_basic_definition_p(rb_cFloat, idPLUS))) {
|
||||
if (FIXNUM_ZERO_P(y))
|
||||
return x;
|
||||
return rb_float_plus(x, y);
|
||||
}
|
||||
else if (RB_TYPE_P(x, T_RATIONAL) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(rb_cRational, idPLUS))) {
|
||||
LIKELY(rb_method_basic_definition_p(rb_cRational, idPLUS))) {
|
||||
if (FIXNUM_ZERO_P(y))
|
||||
return x;
|
||||
return rb_rational_plus(x, y);
|
||||
|
@ -124,7 +124,7 @@ inline static VALUE
|
|||
f_mul(VALUE x, VALUE y)
|
||||
{
|
||||
if (RB_INTEGER_TYPE_P(x) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(rb_cInteger, idMULT))) {
|
||||
LIKELY(rb_method_basic_definition_p(rb_cInteger, idMULT))) {
|
||||
if (FIXNUM_ZERO_P(y))
|
||||
return ZERO;
|
||||
if (FIXNUM_ZERO_P(x) && RB_INTEGER_TYPE_P(y))
|
||||
|
@ -134,16 +134,16 @@ f_mul(VALUE x, VALUE y)
|
|||
return rb_int_mul(x, y);
|
||||
}
|
||||
else if (RB_FLOAT_TYPE_P(x) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(rb_cFloat, idMULT))) {
|
||||
LIKELY(rb_method_basic_definition_p(rb_cFloat, idMULT))) {
|
||||
if (y == ONE) return x;
|
||||
return rb_float_mul(x, y);
|
||||
}
|
||||
else if (RB_TYPE_P(x, T_RATIONAL) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(rb_cRational, idMULT))) {
|
||||
LIKELY(rb_method_basic_definition_p(rb_cRational, idMULT))) {
|
||||
if (y == ONE) return x;
|
||||
return rb_rational_mul(x, y);
|
||||
}
|
||||
else if (UNLIKELY(rb_method_basic_definition_p(CLASS_OF(x), idMULT))) {
|
||||
else if (LIKELY(rb_method_basic_definition_p(CLASS_OF(x), idMULT))) {
|
||||
if (y == ONE) return x;
|
||||
}
|
||||
return rb_funcall(x, '*', 1, y);
|
||||
|
@ -153,7 +153,7 @@ inline static VALUE
|
|||
f_sub(VALUE x, VALUE y)
|
||||
{
|
||||
if (FIXNUM_ZERO_P(y) &&
|
||||
UNLIKELY(rb_method_basic_definition_p(CLASS_OF(x), idMINUS))) {
|
||||
LIKELY(rb_method_basic_definition_p(CLASS_OF(x), idMINUS))) {
|
||||
return x;
|
||||
}
|
||||
return rb_funcall(x, '-', 1, y);
|
||||
|
|
Loading…
Reference in a new issue