lib/gogyou/mixin.rb in gogyou-0.2.2 vs lib/gogyou/mixin.rb in gogyou-0.2.3
- old
+ new
@@ -318,58 +318,58 @@
def loadile(index, bytesize)
loadule(index, bytesize).extendsign(bytesize * BITS_PER_BYTE)
end
def loadu8(index)
- getbyte(index.to_i)
+ getbyte(index)
end
def loadi8(index)
- loadu8(index).extendsign(8)
+ getbyte(index).extendsign(8)
end
def loadu16be(index)
- (loadu8(index) << 8) | loadu8(index + 1)
+ (getbyte(index) << 8) | getbyte(index + 1)
end
def loadi16be(index)
loadu16be(index).extendsign(16)
end
def loadu16le(index)
- loadu8(index) | (loadu8(index + 1) << 8)
+ getbyte(index) | (getbyte(index + 1) << 8)
end
def loadi16le(index)
loadu16le(index).extendsign(16)
end
def loadu24be(index)
- (loadu8(index) << 16) | (loadu8(index + 1) << 8) | loadu8(index + 2)
+ (getbyte(index) << 16) | (getbyte(index + 1) << 8) | getbyte(index + 2)
end
def loadi24be(index)
loadu24be(index).extendsign(24)
end
def loadu24le(index)
- loadu8(index) | (loadu8(index + 1) << 8) | (loadu8(index + 2) << 16)
+ getbyte(index) | (getbyte(index + 1) << 8) | (getbyte(index + 2) << 16)
end
def loadi24le(index)
loadu24le(index).extendsign(24)
end
def loadu32be(index)
- (loadu8(index) << 24) | (loadu8(index + 1) << 16) | (loadu8(index + 2) << 8) | loadu8(index + 3)
+ (getbyte(index) << 24) | (getbyte(index + 1) << 16) | (getbyte(index + 2) << 8) | getbyte(index + 3)
end
def loadi32be(index)
loadu32be(index).extendsign(32)
end
def loadu32le(index)
- loadu8(index) | (loadu8(index + 1) << 8) | (loadu8(index + 2) << 16) | (loadu8(index + 3) << 24)
+ getbyte(index) | (getbyte(index + 1) << 8) | (getbyte(index + 2) << 16) | (getbyte(index + 3) << 24)
end
def loadi32le(index)
loadu32le(index).extendsign(32)
end