Merge pull request #6 from github/write-1-speed

speed up `write_1` calls
This commit is contained in:
Brian Lopez 2016-08-11 08:56:45 -07:00 коммит произвёл GitHub
Родитель d6abc9afc0 63758fe5c6
Коммит c489ecd510
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -97,18 +97,18 @@ module BERT
def write_any_raw obj def write_any_raw obj
case obj case obj
when Symbol then write_symbol(obj) when Symbol then write_symbol(obj)
when String then write_binary(obj)
when Fixnum, Bignum then write_fixnum(obj) when Fixnum, Bignum then write_fixnum(obj)
when Float then write_float(obj) when Float then write_float(obj)
when Tuple then write_tuple(obj) when Tuple then write_tuple(obj)
when Array then write_list(obj) when Array then write_list(obj)
when String then write_binary(obj)
else else
fail(obj) fail(obj)
end end
end end
def write_1(byte) def write_1(byte)
out.write([byte].pack("C")) out.write(byte.chr)
end end
def write_2(short) def write_2(short)