optimize data_buffer:put_bytes for Bytearray
This commit is contained in:
parent
4ce2f3edca
commit
212cc486d4
@ -72,9 +72,14 @@ function data_buffer:put_byte(byte)
|
||||
end
|
||||
|
||||
function data_buffer:put_bytes(bytes)
|
||||
for i = 1, #bytes do
|
||||
self:put_byte(bytes[i])
|
||||
end
|
||||
if type(self.bytes) == 'table' then
|
||||
for i = 1, #bytes do
|
||||
self:put_byte(bytes[i])
|
||||
end
|
||||
else
|
||||
self.bytes:append(bytes)
|
||||
self.pos = self.pos + #bytes
|
||||
end
|
||||
end
|
||||
|
||||
function data_buffer:put_single(single)
|
||||
@ -308,4 +313,4 @@ end
|
||||
|
||||
setmetatable(data_buffer, data_buffer)
|
||||
|
||||
return data_buffer
|
||||
return data_buffer
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user