Optimize ByteBuffer#get_int.
This commit is contained in:
parent
026e409d6d
commit
1c25541492
|
@ -173,8 +173,7 @@ module BSON
|
||||||
|
|
||||||
def get_int
|
def get_int
|
||||||
check_read_length(4)
|
check_read_length(4)
|
||||||
vals = ""
|
vals = buf[@cursor..@cursor+3].pack("C*")
|
||||||
(@cursor..@cursor+3).each { |i| vals << buf[i].chr }
|
|
||||||
@cursor += 4
|
@cursor += 4
|
||||||
vals.unpack(@int_pack_order)[0]
|
vals.unpack(@int_pack_order)[0]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue