Unverified Commit e790fb51 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4710 from shuujii/refactor-mrb_type-in-include-mruby-boxing_word.h

Refactor `mrb_type` in `include/mruby/boxing_word.h`
parents 76355dee 7fcda585
...@@ -144,22 +144,12 @@ MRB_API mrb_value mrb_word_boxing_float_pool(struct mrb_state*, mrb_float); ...@@ -144,22 +144,12 @@ MRB_API mrb_value mrb_word_boxing_float_pool(struct mrb_state*, mrb_float);
MRB_INLINE enum mrb_vtype MRB_INLINE enum mrb_vtype
mrb_type(mrb_value o) mrb_type(mrb_value o)
{ {
switch (o.w) { return !mrb_bool(o) ? MRB_TT_FALSE :
case MRB_Qfalse: mrb_true_p(o) ? MRB_TT_TRUE :
case MRB_Qnil: mrb_fixnum_p(o) ? MRB_TT_FIXNUM :
return MRB_TT_FALSE; mrb_symbol_p(o) ? MRB_TT_SYMBOL :
case MRB_Qtrue: mrb_undef_p(o) ? MRB_TT_UNDEF :
return MRB_TT_TRUE; o.value.bp->tt;
case MRB_Qundef:
return MRB_TT_UNDEF;
}
if (mrb_fixnum_p(o)) {
return MRB_TT_FIXNUM;
}
if (mrb_symbol_p(o)) {
return MRB_TT_SYMBOL;
}
return o.value.bp->tt;
} }
#endif /* MRUBY_BOXING_WORD_H */ #endif /* MRUBY_BOXING_WORD_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment