Skip to content

Commit c1aee2a

Browse files
committed
Fix incorrect results for bitsLeft
1 parent 4c603cd commit c1aee2a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Sources/LsbBitReader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public final class LsbBitReader: ByteReader, BitReader {
1818

1919
// Amount of bits left to read.
2020
public var bitsLeft: Int {
21-
if isFinished {
21+
if self.isFinished {
2222
return 0
2323
} else {
24-
return (self.data.endIndex - self.offset) * 8 + 8 - bitMask.trailingZeroBitCount
24+
return (self.data.endIndex - self.offset) * 8 - self.bitMask.trailingZeroBitCount
2525
}
2626
}
2727

Sources/MsbBitReader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public final class MsbBitReader: ByteReader, BitReader {
1818

1919
// Amount of bits left to read.
2020
public var bitsLeft: Int {
21-
if isFinished {
21+
if self.isFinished {
2222
return 0
2323
} else {
24-
return (self.data.endIndex - self.offset) * 8 + 8 - bitMask.leadingZeroBitCount
24+
return (self.data.endIndex - self.offset) * 8 - self.bitMask.leadingZeroBitCount
2525
}
2626
}
2727

0 commit comments

Comments
 (0)