def pushQueueNBits(self, bits): self.lastBitsCache = self.lastBitsCache + bits while len(self.lastBitsCache) >= 8: idx = 8 self.remainingBytes.append(utils.fromBinary(self.lastBitsCache[0:idx])) self.lastBitsCache = self.lastBitsCache[idx:]
def pushNBits(self, bits): self.firstBitsCache = bits + self.firstBitsCache while len(self.firstBitsCache) >= 8: idx = len(self.firstBitsCache) - 8 self.remainingBytes.insert(0, utils.fromBinary(self.firstBitsCache[idx:])) self.firstBitsCache = self.firstBitsCache[0:idx]