Overview
Comment: | Minor optimizations to fibonacci.Encoder |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
98661a7373a227c7d052e5303913980c |
User & Date: | spaskalev on 2015-01-02 14:35:48 |
Other Links: | manifest | tags |
Context
2015-01-02
| ||
17:55 | update the copyright notice for 2015 check-in: 783d0b7f51 user: spaskalev tags: trunk | |
14:35 | Minor optimizations to fibonacci.Encoder check-in: 98661a7373 user: spaskalev tags: trunk | |
2015-01-01
| ||
15:19 | [fibonacci] renamed Writer->Encoder, Reader->Decoder. [mtf] moved package mtf to encoding\mtf check-in: cb736e7ad3 user: spaskalev tags: trunk | |
Changes
Modified src/0dev.org/encoding/fibonacci/fib.go from [3231551b1f] to [4b4dfe919b].
︙ | |||
128 129 130 131 132 133 134 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | + - + + + + + + + + - + | continue } // Clearing e.length is not necessary as it will be overwritten later // Stage the complete byte for writing buffer := make([]byte, 1, 2) |
︙ | |||
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | + + + | output[0] = byte(val) // Advance the internal and output buffers output = output[1:] d.buffer >>= len d.at -= len // Account for the processed output byte total++ } // Termination condition if len(output) == 0 || err != nil { return total, err } // We need to limit the output's size else we could end up with a lot of small values // that fit neither in the output slice nor in the internal buffer // // (63 is [0011 1111] in binary, xor is a substraction and right shift a division) free := int((63 ^ d.at) >> 3) if free > len(output) { free = len(output) } // Read data and transfer to the internal buffer count, err := d.source.Read(output[:free]) |
︙ |