summaryrefslogtreecommitdiff
path: root/src/pkg/compress/bzip2/bit_reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/compress/bzip2/bit_reader.go')
-rw-r--r--src/pkg/compress/bzip2/bit_reader.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pkg/compress/bzip2/bit_reader.go b/src/pkg/compress/bzip2/bit_reader.go
index ab1d60651..32d1036ae 100644
--- a/src/pkg/compress/bzip2/bit_reader.go
+++ b/src/pkg/compress/bzip2/bit_reader.go
@@ -77,6 +77,14 @@ func (br *bitReader) ReadBit() bool {
return n != 0
}
+func (br *bitReader) TryReadBit() (bit byte, ok bool) {
+ if br.bits > 0 {
+ br.bits--
+ return byte(br.n>>br.bits) & 1, true
+ }
+ return 0, false
+}
+
func (br *bitReader) Err() error {
return br.err
}