MCPcopy
hub / github.com/klauspost/compress / transform

Method transform

zstd/fse_decoder.go:274–290  ·  view source on GitHub ↗

transform will transform the decoder table into a table usable for decoding without having to apply the transformation while decoding. The state will contain the base value and the number of bits to read.

(t []baseOffset)

Source from the content-addressed store, hash-verified

272// decoding without having to apply the transformation while decoding.
273// The state will contain the base value and the number of bits to read.
274func (s *fseDecoder) transform(t []baseOffset) error {
275 tableSize := uint16(1 << s.actualTableLog)
276 s.maxBits = 0
277 for i, v := range s.dt[:tableSize] {
278 add := v.addBits()
279 if int(add) >= len(t) {
280 return fmt.Errorf("invalid decoding table entry %d, symbol %d >= max (%d)", i, v.addBits(), len(t))
281 }
282 lu := t[add]
283 if lu.addBits > s.maxBits {
284 s.maxBits = lu.addBits
285 }
286 v.setExt(lu.addBits, lu.baseLine)
287 s.dt[i] = v
288 }
289 return nil
290}
291
292type fseState struct {
293 dt []decSymbol

Callers 3

prepareSequencesMethod · 0.80
initPredefinedFunction · 0.80
loadDictFunction · 0.80

Calls 2

addBitsMethod · 0.80
setExtMethod · 0.80

Tested by

no test coverage detected