From 3ded3d45a6bbbec539099a77e5431cb981507771 Mon Sep 17 00:00:00 2001 From: smiley Date: Tue, 31 Jan 2023 18:54:33 +0100 Subject: [PATCH] :octocat: added BitBuffer::rewind() --- src/Common/BitBuffer.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Common/BitBuffer.php b/src/Common/BitBuffer.php index 9cd0547fe..eba9ec29b 100644 --- a/src/Common/BitBuffer.php +++ b/src/Common/BitBuffer.php @@ -159,8 +159,16 @@ final class BitBuffer{ * Clears the buffer and resets the stats */ public function clear():self{ - $this->buffer = []; - $this->length = 0; + $this->buffer = []; + $this->length = 0; + + return $this->rewind(); + } + + /** + * Resets the read-counters + */ + public function rewind():self{ $this->bytesRead = 0; $this->bitsRead = 0;