Skip to content

Commit

Permalink
Reset position in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
flanglet committed Sep 15, 2024
1 parent 6a9932d commit 9b9393f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion v2/bitstream/DefaultInputBitStream.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (this *DefaultInputBitStream) ReadArray(bits []byte, count uint) uint {
// Copy internal buffer to bits array
for (remaining >> 3) > availBytes {
copy(bits[start:], this.buffer[this.position:this.maxPosition+1])
this.position = this.maxPosition + 1
start += availBytes
remaining -= (availBytes << 3)

Expand Down Expand Up @@ -217,7 +218,7 @@ func (this *DefaultInputBitStream) readFromInputStream(count int) (int, error) {
return 0, nil
}

this.read += int64(this.position << 3)
this.read += (int64(this.position << 3))
size, err := this.is.Read(this.buffer[0:count])
this.position = 0

Expand Down

0 comments on commit 9b9393f

Please sign in to comment.