lib/bindata/int.rb in bindata-0.9.0 vs lib/bindata/int.rb in bindata-0.9.1
- old
+ new
@@ -36,14 +36,14 @@
c32 = (endian == :little) ? 'V' : 'N'
b1 = (endian == :little) ? 0 : 1
b2 = (endian == :little) ? 1 : 0
case nbits
- when 8; "readbytes(io,1)[0]"
- when 16; "readbytes(io,2).unpack('#{c16}').at(0)"
- when 32; "readbytes(io,4).unpack('#{c32}').at(0)"
- when 64; "(a = readbytes(io,8).unpack('#{c32 * 2}'); " +
+ when 8; "io.readbytes(1).unpack('C').at(0)"
+ when 16; "io.readbytes(2).unpack('#{c16}').at(0)"
+ when 32; "io.readbytes(4).unpack('#{c32}').at(0)"
+ when 64; "(a = io.readbytes(8).unpack('#{c32 * 2}'); " +
"(a.at(#{b2}) << 32) + a.at(#{b1}))"
else
raise "unknown nbits '#{nbits}'"
end
end
@@ -71,10 +71,10 @@
def value=(val)
#{clamp}
super(val)
end
- def _num_bytes(ignored)
+ def _do_num_bytes(ignored)
#{nbytes}
end
#---------------
private