realign discards the whole bytes the word refill buffered in the accumulator by rewinding the read position, so byte-oriented reads can proceed directly from (and alias) the underlying buffer. Only valid when byte-aligned, i.e. bitCount is a multiple of 8.
()
| 140 | // from (and alias) the underlying buffer. Only valid when byte-aligned, i.e. |
| 141 | // bitCount is a multiple of 8. |
| 142 | func (r *reader) realign() { |
| 143 | r.pos -= r.bitCount >> 3 |
| 144 | r.bitVal = 0 |
| 145 | r.bitCount = 0 |
| 146 | } |
| 147 | |
| 148 | // readByte reads a single byte |
| 149 | func (r *reader) readByte() byte { |