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

Method buildDtable

zstd/fse_decoder_asm.go:39–68  ·  view source on GitHub ↗

buildDtable will build the decoding table.

()

Source from the content-addressed store, hash-verified

37
38// buildDtable will build the decoding table.
39func (s *fseDecoder) buildDtable() error {
40 ctx := buildDtableAsmContext{
41 stateTable: &s.stateTable[0],
42 norm: &s.norm[0],
43 dt: (*uint64)(&s.dt[0]),
44 }
45 code := buildDtable_asm(s, &ctx)
46
47 if code != 0 {
48 switch code {
49 case errorCorruptedNormalizedCounter:
50 position := ctx.errParam1
51 return fmt.Errorf("corrupted input (position=%d, expected 0)", position)
52
53 case errorNewStateTooBig:
54 newState := decSymbol(ctx.errParam1)
55 size := ctx.errParam2
56 return fmt.Errorf("newState (%d) outside table size (%d)", newState, size)
57
58 case errorNewStateNoBits:
59 newState := decSymbol(ctx.errParam1)
60 oldState := decSymbol(ctx.errParam2)
61 return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, oldState)
62
63 default:
64 return fmt.Errorf("buildDtable_asm returned unhandled nonzero code = %d", code)
65 }
66 }
67 return nil
68}

Callers 4

readNCountMethod · 0.95
initPredefinedFunction · 0.45
BenchmarkBuildDtableFunction · 0.45

Calls 2

buildDtable_asmFunction · 0.85
decSymbolTypeAlias · 0.70

Tested by 2

BenchmarkBuildDtableFunction · 0.36