Overview
Comment: | [fibonacci] renamed Writer->Encoder, Reader->Decoder. [mtf] moved package mtf to encoding\mtf |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cb736e7ad34d3611e2e73ff5ea54e76c |
User & Date: | spaskalev on 2015-01-01 15:19:21 |
Other Links: | manifest | tags |
Context
2015-01-02
| ||
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 | |
15:12 | Use a common fibonacci number source for each encoder and decoder. Dropped the two-bytes buffer from the encoder struct. check-in: f1a8d5baa9 user: spaskalev tags: trunk | |
Changes
Modified src/0dev.org/commands/mtf/main.go from [b672c1daee] to [8212c2eba2].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 | + - | package main import ( mtf "0dev.org/encoding/mtf" iou "0dev.org/ioutil" |
︙ |
Modified src/0dev.org/encoding/fibonacci/fib.go from [5685c81b13] to [3231551b1f].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | + | // 0 - 11, 1 - 110, 2 - 1100, 3 - 1101, 4 - 11000 package fibonacci import ( "io" ) // Alias type with methods for encoding and decoding integers type Numbers []uint64 var ( // Used for encoding and decoding byte values bytesCodec = New(14) ) |
︙ | |||
75 76 77 78 79 80 81 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | + - + + | value >>= 1 length++ } return result + f[length] - 1, length + 1 } // Returns a fibonacci encoder over the provided io.Writer |
︙ | |||
151 152 153 154 155 156 157 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | + - + + | // Account for the processed input byte total++ } return total, err } // Returns a fibonacci decoder over the provided io.Reader |
︙ |
Modified src/0dev.org/encoding/fibonacci/fib_test.go from [33c293fd3b] to [7b29d51e21].
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + | } } } func TestWriterReader(t *testing.T) { var ( buf bytes.Buffer |
︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | - + | t.Fatal("Unexpected location for", i, "value", vs) } output = output[len(vs):] } var ( in *bytes.Reader = bytes.NewReader(buf.Bytes()) |
︙ |
Name change from src/0dev.org/mtf/mtf.go to src/0dev.org/encoding/mtf/mtf.go.
︙ |
Name change from src/0dev.org/mtf/mtf_test.go to src/0dev.org/encoding/mtf/mtf_test.go.
︙ |