@@ -11,7 +11,13 @@ public final class MsbBitReader: ByteReader, BitReader {
1111 private var bitMask : UInt8 = 128
1212 private var currentByte : UInt8
1313
14- private var bitsLeft : Int {
14+ /// True, if reader's BIT pointer is aligned with the BYTE border.
15+ public var isAligned : Bool {
16+ return self . bitMask == 128
17+ }
18+
19+ // Amount of bits left to read.
20+ public var bitsLeft : Int {
1521 if isFinished {
1622 return 0
1723 } else {
@@ -27,19 +33,14 @@ public final class MsbBitReader: ByteReader, BitReader {
2733
2834 /**
2935 Converts a `ByteReader` instance into `MsbBitReader`, enabling bit reading capabilities.
30- Current `offset` value in `byteReader` is preserved.
36+ Current `offset` value of `byteReader` is preserved.
3137 */
3238 public init ( _ byteReader: ByteReader ) {
3339 self . currentByte = byteReader. offset < byteReader. data. endIndex ? byteReader. data [ byteReader. offset] : 0
3440 super. init ( data: byteReader. data)
3541 self . offset = byteReader. offset
3642 }
3743
38- /// True, if reader's BIT pointer is aligned with the BYTE border.
39- public var isAligned : Bool {
40- return self . bitMask == 128
41- }
42-
4344 /**
4445 Reads bit and returns it, advancing by one BIT position.
4546
0 commit comments