allocCtable will allocate tables needed for compression. If existing tables a re big enough, they are simply re-used.
()
| 79 | // allocCtable will allocate tables needed for compression. |
| 80 | // If existing tables a re big enough, they are simply re-used. |
| 81 | func (s *fseEncoder) allocCtable() { |
| 82 | tableSize := 1 << s.actualTableLog |
| 83 | // get tableSymbol that is big enough. |
| 84 | if cap(s.ct.tableSymbol) < tableSize { |
| 85 | s.ct.tableSymbol = make([]byte, tableSize) |
| 86 | } |
| 87 | s.ct.tableSymbol = s.ct.tableSymbol[:tableSize] |
| 88 | |
| 89 | ctSize := tableSize |
| 90 | if cap(s.ct.stateTable) < ctSize { |
| 91 | s.ct.stateTable = make([]uint16, ctSize) |
| 92 | } |
| 93 | s.ct.stateTable = s.ct.stateTable[:ctSize] |
| 94 | |
| 95 | if cap(s.ct.symbolTT) < 256 { |
| 96 | s.ct.symbolTT = make([]symbolTransform, 256) |
| 97 | } |
| 98 | s.ct.symbolTT = s.ct.symbolTT[:256] |
| 99 | } |
| 100 | |
| 101 | // buildCTable will populate the compression table so it is ready to be used. |
| 102 | func (s *fseEncoder) buildCTable() error { |
no outgoing calls
no test coverage detected