Using String#unpack instead of String#bytes to work with Ruby < 1.8.7
This commit is contained in:
parent
b43223b637
commit
d9d3857ee0
@ -15,7 +15,7 @@ module Compass
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def crc(chunkdata='')
|
def crc(chunkdata='')
|
||||||
chunkdata.bytes.to_a.inject(0xffffffff){|crc, byte| CRC_TABLE[(crc ^ byte) & 0xff] ^ (crc >> 8) } ^ 0xffffffff
|
chunkdata.unpack('C*').to_a.inject(0xffffffff){|crc, byte| CRC_TABLE[(crc ^ byte) & 0xff] ^ (crc >> 8) } ^ 0xffffffff
|
||||||
end
|
end
|
||||||
|
|
||||||
def chunk(type, data="")
|
def chunk(type, data="")
|
||||||
|
Loading…
Reference in New Issue
Block a user