fill() will make sure at least 32 bits are available.
()
| 84 | |
| 85 | // fill() will make sure at least 32 bits are available. |
| 86 | func (b *bitReader) fill() { |
| 87 | if b.bitsRead < 32 { |
| 88 | return |
| 89 | } |
| 90 | if b.cursor >= 4 { |
| 91 | b.cursor -= 4 |
| 92 | b.value = (b.value << 32) | uint64(le.Load32(b.in, b.cursor)) |
| 93 | b.bitsRead -= 32 |
| 94 | return |
| 95 | } |
| 96 | |
| 97 | b.bitsRead -= uint8(8 * b.cursor) |
| 98 | for b.cursor > 0 { |
| 99 | b.cursor -= 1 |
| 100 | b.value = (b.value << 8) | uint64(b.in[b.cursor]) |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | // finished returns true if all bits have been read from the bit stream. |
| 105 | func (b *bitReader) finished() bool { |