File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,42 +7,42 @@ import Foundation
77
88/// A type that contains functions for writing `Data` bit-by-bit (and byte-by-byte).
99public protocol BitWriter {
10-
10+
1111 /// Data which contains writer's output (the last byte in progress is not included).
1212 var data : Data { get }
13-
13+
1414 /// True, if writer's BIT pointer is aligned with the BYTE border.
1515 var isAligned : Bool { get }
16-
16+
1717 /// Creates an instance for writing bits (and bytes).
1818 init ( )
19-
19+
2020 /// Writes `bit`, advancing by one BIT position.
2121 func write( bit: UInt8 )
22-
22+
2323 /// Writes `bits`, advancing by `bits.count` BIT positions.
2424 func write( bits: [ UInt8 ] )
25-
25+
2626 /// Writes `number`, using and advancing by `bitsCount` BIT positions.
2727 func write( number: Int , bitsCount: Int )
28-
28+
2929 /// Writes `byte`, advancing by one BYTE position.
3030 func append( byte: UInt8 )
31-
31+
3232 /**
3333 Aligns writer's BIT pointer to the BYTE border, i.e. moves BIT pointer to the first BIT of the next BYTE,
3434 filling all skipped BIT positions with zeros.
3535 */
3636 func align( )
37-
37+
3838}
3939
4040extension BitWriter {
41-
41+
4242 public func write( bits: [ UInt8 ] ) {
4343 for bit in bits {
4444 self . write ( bit: bit)
4545 }
4646 }
47-
47+
4848}
You can’t perform that action at this time.
0 commit comments