setBits will set output bits for the transform. if nil is provided, the number of bits is equal to the index.
(transform []byte)
| 223 | // setBits will set output bits for the transform. |
| 224 | // if nil is provided, the number of bits is equal to the index. |
| 225 | func (s *fseEncoder) setBits(transform []byte) { |
| 226 | if s.reUsed || s.preDefined { |
| 227 | return |
| 228 | } |
| 229 | if s.useRLE { |
| 230 | if transform == nil { |
| 231 | s.ct.symbolTT[s.rleVal].outBits = s.rleVal |
| 232 | s.maxBits = s.rleVal |
| 233 | return |
| 234 | } |
| 235 | s.maxBits = transform[s.rleVal] |
| 236 | s.ct.symbolTT[s.rleVal].outBits = s.maxBits |
| 237 | return |
| 238 | } |
| 239 | if transform == nil { |
| 240 | for i := range s.ct.symbolTT[:s.symbolLen] { |
| 241 | s.ct.symbolTT[i].outBits = uint8(i) |
| 242 | } |
| 243 | s.maxBits = uint8(s.symbolLen - 1) |
| 244 | return |
| 245 | } |
| 246 | s.maxBits = 0 |
| 247 | for i, v := range transform[:s.symbolLen] { |
| 248 | s.ct.symbolTT[i].outBits = v |
| 249 | if v > s.maxBits { |
| 250 | // We could assume bits always going up, but we play safe. |
| 251 | s.maxBits = v |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | // normalizeCount will normalize the count of the symbols so |
| 257 | // the total is equal to the table size. |
no outgoing calls
no test coverage detected