aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-29 11:07:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-29 11:07:45 +0000
commit8e6e8e628888aa251f771ce8b3fe30a6b41a7a0e (patch)
treee531ed455f2ffb110e9a16de2161b3865a19d582 /complex.c
parent68f97d7851481e11ce90bb349345dc4caed00cf7 (diff)
downloadruby-8e6e8e628888aa251f771ce8b3fe30a6b41a7a0e.tar.gz
* use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/complex.c b/complex.c
index a701129b73..fd0088c574 100644
--- a/complex.c
+++ b/complex.c
@@ -121,7 +121,7 @@ f_mul(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
long iy = FIX2LONG(y);
if (iy == 0) {
- if (FIXNUM_P(x) || TYPE(x) == T_BIGNUM)
+ if (FIXNUM_P(x) || RB_TYPE_P(x, T_BIGNUM))
return ZERO;
}
else if (iy == 1)
@@ -130,7 +130,7 @@ f_mul(VALUE x, VALUE y)
else if (FIXNUM_P(x)) {
long ix = FIX2LONG(x);
if (ix == 0) {
- if (FIXNUM_P(y) || TYPE(y) == T_BIGNUM)
+ if (FIXNUM_P(y) || RB_TYPE_P(y, T_BIGNUM))
return ZERO;
}
else if (ix == 1)
@@ -166,14 +166,14 @@ fun1(real_p)
inline static VALUE
f_to_i(VALUE x)
{
- if (TYPE(x) == T_STRING)
+ if (RB_TYPE_P(x, T_STRING))
return rb_str_to_inum(x, 10, 0);
return rb_funcall(x, id_to_i, 0);
}
inline static VALUE
f_to_f(VALUE x)
{
- if (TYPE(x) == T_STRING)
+ if (RB_TYPE_P(x, T_STRING))
return DBL2NUM(rb_str_to_dbl(x, 0));
return rb_funcall(x, id_to_f, 0);
}
@@ -944,7 +944,7 @@ nucomp_coerce(VALUE self, VALUE other)
{
if (k_numeric_p(other) && f_real_p(other))
return rb_assoc_new(f_complex_new_bang1(CLASS_OF(self), other), self);
- if (TYPE(other) == T_COMPLEX)
+ if (RB_TYPE_P(other, T_COMPLEX))
return rb_assoc_new(other, self);
rb_raise(rb_eTypeError, "%s can't be coerced into %s",