This commit is contained in:
Andrew Murray 2025-05-23 16:19:19 +00:00 committed by GitHub
commit 8bc1b8fbb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,11 +33,7 @@ class BitStream:
def peek(self, bits: int) -> int:
while self.bits < bits:
c = self.next()
if c < 0:
self.bits = 0
continue
self.bitbuffer = (self.bitbuffer << 8) + c
self.bitbuffer = (self.bitbuffer << 8) + self.next()
self.bits += 8
return self.bitbuffer >> (self.bits - bits) & (1 << bits) - 1