diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-29 11:07:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-29 11:07:45 +0000 |
commit | 8e6e8e628888aa251f771ce8b3fe30a6b41a7a0e (patch) | |
tree | e531ed455f2ffb110e9a16de2161b3865a19d582 /pack.c | |
parent | 68f97d7851481e11ce90bb349345dc4caed00cf7 (diff) | |
download | ruby-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 'pack.c')
-rw-r--r-- | pack.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -243,7 +243,7 @@ num2i32(VALUE x) x = rb_to_int(x); /* is nil OK? (should not) */ if (FIXNUM_P(x)) return FIX2LONG(x); - if (TYPE(x) == T_BIGNUM) { + if (RB_TYPE_P(x, T_BIGNUM)) { return rb_big2ulong_pack(x); } rb_raise(rb_eTypeError, "can't convert %s to `integer'", rb_obj_classname(x)); @@ -995,9 +995,9 @@ pack_pack(VALUE ary, VALUE fmt) char c, *bufs, *bufe; from = NEXTFROM; - if (TYPE(from) == T_BIGNUM) { + if (RB_TYPE_P(from, T_BIGNUM)) { VALUE big128 = rb_uint2big(128); - while (TYPE(from) == T_BIGNUM) { + while (RB_TYPE_P(from, T_BIGNUM)) { from = rb_big_divmod(from, big128); c = NUM2INT(RARRAY_PTR(from)[1]) | 0x80; /* mod */ rb_str_buf_cat(buf, &c, sizeof(char)); |