# File ruby/bstream.rb, line 80
        def check_type(arg)
          return T_NULL if arg.nil?
          c = arg.class
          if c ==  Bignum then
                targ = arg.abs
                if (0x7fff_ffff_ffff_ffff & targ) == targ then
                  return T_INTEGER8
                else
                  return T_DECIMAL
                end
          elsif c ==  Fixnum then
                targ = arg.abs
                if (0x7f & targ) == targ then
                  return T_INTEGER1
                elsif (0x7fff & targ) == targ then
                  return T_INTEGER2
                elsif (0x7fff_ffff & targ) == targ then
                  return T_INTEGER4
                end
          elsif c ==  Float then
                return T_DOUBLE
          elsif c ==  String then
                return T_STRING
          elsif c ==  Array then
                return T_ARRAY
          elsif c ==  TrueClass then
                return T_BOOLEAN_TRUE
          elsif c ==  FalseClass then
                return T_BOOLEAN_FALSE
          end
          return nil
        end