mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-10-01 15:46:17 -04:00
Hopefully made older go happy about bitshifts.
This commit is contained in:
parent
4f4dfccee0
commit
c4a27ad5ab
@ -29,7 +29,7 @@ func (v *BitStream) ReadBits(bitCount int) int {
|
|||||||
if !v.EnsureBits(bitCount) {
|
if !v.EnsureBits(bitCount) {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
result := v.current & (0xffff >> (16 - bitCount))
|
result := v.current & (0xffff >> uint(16-bitCount))
|
||||||
v.WasteBits(bitCount)
|
v.WasteBits(bitCount)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@ -52,13 +52,13 @@ func (v *BitStream) EnsureBits(bitCount int) bool {
|
|||||||
}
|
}
|
||||||
nextValue := v.data[v.dataPosition]
|
nextValue := v.data[v.dataPosition]
|
||||||
v.dataPosition++
|
v.dataPosition++
|
||||||
v.current |= int(nextValue) << v.bitCount
|
v.current |= int(nextValue) << uint(v.bitCount)
|
||||||
v.bitCount += 8
|
v.bitCount += 8
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// WasteBits dry-reads the specified number of bits
|
// WasteBits dry-reads the specified number of bits
|
||||||
func (v *BitStream) WasteBits(bitCount int) {
|
func (v *BitStream) WasteBits(bitCount int) {
|
||||||
v.current >>= bitCount
|
v.current >>= uint(bitCount)
|
||||||
v.bitCount -= bitCount
|
v.bitCount -= bitCount
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user